Пример #1
0
        public void RemoveUsings()
        {
            //arrange
            var srcDoc = new SrcDoc()
            {
                SyntaxTree = CSharpSyntaxTree.ParseText(helloworld1_cs)
            };

            //act
            UsingsConsolidateAndStrip usingsrewriter = new UsingsConsolidateAndStrip();
            var updatedRoot = usingsrewriter.RemoveTopLevelUsings(srcDoc);

            //assert
            updatedRoot.Usings.Count.Should().Be(0);
        }
Пример #2
0
        public void FindUsings()
        {
            //arrange
            string[] startingUsings = new string[] { "System", "System.Collections", "System.Text" };

            //act
            var srcdoc = new SrcDoc()
            {
                SyntaxTree = CSharpSyntaxTree.ParseText(helloworld1_cs)
            };
            UsingsConsolidateAndStrip usingsrewriter = new UsingsConsolidateAndStrip();
            var usings = usingsrewriter.FindUsings(srcdoc);

            //assert
            usings.Select(_ => _.Name.ToString()).ToArray()
            .Should().BeEquivalentTo(startingUsings);
        }