daveoftheparty / speedy-moq

Generate boilerplate code for Moq in C#
MIT License
1 stars 0 forks source link

bug: indentation level #11

Closed daveoftheparty closed 3 years ago

daveoftheparty commented 3 years ago

Currently the indentation level for the code generator is hard-coded to 3 tab stops.

The scenario is we start here:

        [Test]
        public void HappyPath()
        {
            IStringAnalyzer
        }

and end up here with three extra indents on the first line.

        [Test]
        public void HappyPath()
        {
                        var stringAnalyzer = new Mock<IStringAnalyzer>();
            Expression<Func<IStringAnalyzer, int>> howManyItems = x => x.HowManyItems(It.IsAny<string>(), It.IsAny<char>());
            stringAnalyzer
                .Setup(howManyItems)
                .Returns((string patient, char charToCount) =>
                {
                    return;
                });

            stringAnalyzer.Verify(howManyItems, Times.Once);
        }
daveoftheparty commented 3 years ago

There may very well be other indentation bugs when it comes to user preferences on tabs vs. spaces (the code generator is using tabs both to indent a whole line, and, to sub-indent items such as .Setup(howManyItems) above.

These preference problems may or may not get hairy with things like other extensions (EditorConfig, for example) modifying the settings for files that override the IDE user settings.

In any case, we should handle THOSE by filing different bug issues and keep this issue focused to address only the problem as originally described.