Exemple #1
0
        public static void ParseInfo()
        {
            var file     = SolutionFile.Find("Gu.Roslyn.Asserts.sln");
            var sln      = SolutionFile.ParseInfo(file);
            var expected = new[]
            {
                "Gu.Roslyn.Asserts",
                "Gu.Roslyn.Asserts.Analyzers",
                "Gu.Roslyn.Asserts.Analyzers.Tests",
                "Gu.Roslyn.Asserts.Analyzers.Vsix",
                "Gu.Roslyn.Asserts.Tests",
                "Gu.Roslyn.Asserts.Tests.Net472WithAttributes",
                "Gu.Roslyn.Asserts.Tests.NetCoreWithAttributes",
                "AstView",
                "WpfApp1",
                "ClassLibrary2",
                "ClassLibrary1",
            };

            CollectionAssert.AreEquivalent(expected, sln.Projects.Select(x => x.Name));
            var assertsProject = sln.Projects.Single(x => x.Name == "Gu.Roslyn.Asserts");

            var analyzersProject = sln.Projects.Single(x => x.Name == "Gu.Roslyn.Asserts.Analyzers");

            CollectionAssert.IsEmpty(analyzersProject.ProjectReferences);
            var testProject = sln.Projects.Single(x => x.Name == "Gu.Roslyn.Asserts.Tests");

            CollectionAssert.AreEqual(new[] { assertsProject.Id }, testProject.ProjectReferences.Select(x => x.ProjectId).ToArray());
        }