NArrange.Tests.CSharp.CSharpTestFile.GetReader C# (CSharp) Method

GetReader() public method

Gets a TextReader for this test file.
public GetReader ( ) : TextReader
return TextReader
        public TextReader GetReader()
        {
            return GetTestFileReader(_resourceName);
        }

Usage Example

Example #1
0
        public void TestAutoPropertyInitializersParseCorrectly()
        {
            CSharpTestFile testFile = CSharpTestUtilities.GetAutoPropertyInitializersFile();

            using (TextReader reader = testFile.GetReader())
            {
                CSharpParser parser = new CSharpParser();
                ReadOnlyCollection <ICodeElement> elements = parser.Parse(reader);
                elements.Should().HaveCount(1, "because there is only one namespace");
                elements[0].Children.Should().HaveCount(1, "because there is 1 class in the namespace");
                elements[0].Children[0].Children.Should().HaveCount(4, "because there are 4 subclasses in the class");
                var customer1 = elements[0].Children[0].Children[0];
                var customer2 = elements[0].Children[0].Children[1];
                var customer3 = elements[0].Children[0].Children[2];
                var customer4 = elements[0].Children[0].Children[3];
                customer1.Children.Should().HaveCount(2, "because there are only 2 properties");
                customer1.Children[0].ElementType.Should().Be(ElementType.Property);
                customer1.Children[1].ElementType.Should().Be(ElementType.Property);
                customer2.Children.Should().HaveCount(2, "because there are only 2 properties");
                customer2.Children[0].ElementType.Should().Be(ElementType.Property);
                customer2.Children[1].ElementType.Should().Be(ElementType.Property);
                customer3.Children.Should().HaveCount(2, "because there is only 1 property and 1 constructor");
                customer3.Children[0].ElementType.Should().Be(ElementType.Property);
                customer3.Children[1].ElementType.Should().Be(ElementType.Constructor);
                customer4.Children.Should().HaveCount(2, "because there are only 2 properties");
                customer4.Children[0].ElementType.Should().Be(ElementType.Property);
                customer4.Children[1].ElementType.Should().Be(ElementType.Property);
            }
        }
All Usage Examples Of NArrange.Tests.CSharp.CSharpTestFile::GetReader