Exemplo n.º 1
0
        public void Format_should_separate_groups_properly_when_formatting_with_custom_match(string testInput, string[] inputUsingNamespaces, string[] expectedOutputNamespaces)
        {
            // Arrange
            var inputUsings = inputUsingNamespaces.Select(ns => new UsingStatement()
            {
                Namespace = ns
            });

            var rule = GroupingRule.Parse(testInput).Single();

            var output = new OutputBuffer();

            // Act
            rule.Format(output, inputUsings);

            // Assert
            var expectedUsings = expectedOutputNamespaces.Select(ns => (ns == "") ? "" : $"using {ns};");

            output
            .GetLines()
            .Zip(expectedUsings)
            .Apply(
                ((string Actual, string Expected)pair, int index) =>
            {
                pair.Actual.Should().Be(pair.Expected, because: $"line {index} should match");
            });