Пример #1
0
        public void Check_ConsolidatedUsings()
        {
            //arrange
            string[] expected_ConsolidatedUsings = new string[] { "System", "System.Collections", "System.Linq", "System.Text" };

            var srcdocList = new List <SrcDoc>();

            srcdocList.Add(new SrcDoc()
            {
                SyntaxTree = CSharpSyntaxTree.ParseText(helloworld1_cs)
            });
            srcdocList.Add(new SrcDoc()
            {
                SyntaxTree = CSharpSyntaxTree.ParseText(helloworld2_cs)
            });

            //act
            var packcmd = new PackCommand(new PackOptions());

            var targetfiles = packcmd.GenerateTargetFilesList(srcdocList);

            packcmd.ConsolidateAndStripGlobalUsings(targetfiles);

            targetfiles.Should().HaveCount(1);
            targetfiles.ElementAt(0).GlobalUsings.Select(_ => _.ToString())
            .Should().BeEquivalentTo(expected_ConsolidatedUsings);
        }