コード例 #1
0
        public IEnumerator GetEnumerator()
        {
            yield return(new
                         TestCaseData
                         (
                             MSBPRDependencyGraph.ResolveProjectReferenceDependencies(new string[] { Path.Combine(TestContext.CurrentContext.TestDirectory, "TestProjects", "ProjectC.csproj") }),
                             new MSBPROptions {
                SortProjects = true
            },
                             $"digraph {{{Environment.NewLine}\"ProjectA.csproj\"{Environment.NewLine}\"ProjectB.csproj\"{Environment.NewLine}\"ProjectC.csproj\"{Environment.NewLine}\"ProjectC.csproj\" -> \"ProjectA.csproj\"{Environment.NewLine}\"ProjectC.csproj\" -> \"ProjectB.csproj\"{Environment.NewLine}}}{Environment.NewLine}"
                         ).SetName("SortedOutput"));

            yield return(new
                         TestCaseData
                         (
                             MSBPRDependencyGraph.ResolveProjectReferenceDependencies(new string[] { Path.Combine(TestContext.CurrentContext.TestDirectory, "TestProjects", "ProjectC.csproj") }),
                             new MSBPROptions {
                SortProjects = true, AnonymizeNames = true
            },
                             $"digraph {{{Environment.NewLine}\"1\"{Environment.NewLine}\"2\"{Environment.NewLine}\"3\"{Environment.NewLine}\"3\" -> \"1\"{Environment.NewLine}\"3\" -> \"2\"{Environment.NewLine}}}{Environment.NewLine}"
                         ).SetName("SortAnonymize"));

            yield return(new
                         TestCaseData
                         (
                             MSBPRDependencyGraph.ResolveProjectReferenceDependencies(new string[] { Path.Combine(TestContext.CurrentContext.TestDirectory, "TestProjects", "ProjectD.csproj") }),
                             new MSBPROptions {
                SortProjects = true, ShowAssemblyReferences = true
            },
                             $"digraph {{{Environment.NewLine}\"ProjectD.csproj\"{Environment.NewLine}//--------------------------{Environment.NewLine}// AssemblyReference Section{Environment.NewLine}//--------------------------{Environment.NewLine}\"Moq\" [class=\"AssemblyReference\"]{Environment.NewLine}\"ProjectD.csproj\" -> \"Moq\"{Environment.NewLine}\"ProjectD.csproj\" -> \"System\"{Environment.NewLine}\"System\" [class=\"AssemblyReference\"]{Environment.NewLine}}}{Environment.NewLine}"
                         ).SetName("SortShowAssemblyReferences"));

            yield return(new
                         TestCaseData
                         (
                             MSBPRDependencyGraph.ResolveProjectReferenceDependencies(new string[] { Path.Combine(TestContext.CurrentContext.TestDirectory, "TestProjects", "ProjectD.csproj") }),
                             new MSBPROptions {
                SortProjects = true, ShowPackageReferences = true
            },
                             $"digraph {{{Environment.NewLine}\"ProjectD.csproj\"{Environment.NewLine}//--------------------------{Environment.NewLine}// PackageReference Section{Environment.NewLine}//--------------------------{Environment.NewLine}\"NUnit\" [class=\"PackageReference\"]{Environment.NewLine}\"ProjectD.csproj\" -> \"NUnit\"{Environment.NewLine}}}{Environment.NewLine}"
                         ).SetName("SortShowPackageReferences"));

            yield return(new
                         TestCaseData
                         (
                             MSBPRDependencyGraph.ResolveProjectReferenceDependencies(new string[] { Path.Combine(TestContext.CurrentContext.TestDirectory, "TestProjects", "ProjectD.csproj") }),
                             new MSBPROptions {
                SortProjects = true, ShowAssemblyReferences = true, ShowPackageReferences = true
            },
                             $"digraph {{{Environment.NewLine}\"ProjectD.csproj\"{Environment.NewLine}//--------------------------{Environment.NewLine}// AssemblyReference Section{Environment.NewLine}//--------------------------{Environment.NewLine}\"Moq\" [class=\"AssemblyReference\"]{Environment.NewLine}\"ProjectD.csproj\" -> \"Moq\"{Environment.NewLine}\"ProjectD.csproj\" -> \"System\"{Environment.NewLine}\"System\" [class=\"AssemblyReference\"]{Environment.NewLine}//--------------------------{Environment.NewLine}// PackageReference Section{Environment.NewLine}//--------------------------{Environment.NewLine}\"NUnit\" [class=\"PackageReference\"]{Environment.NewLine}\"ProjectD.csproj\" -> \"NUnit\"{Environment.NewLine}}}{Environment.NewLine}"
                         ).SetName("SortShowAssemblyShowPackageReferences"));
        }
コード例 #2
0
        public void ResolveAssemblyReferenceDependencies(IEnumerable <string> targetProjects, Dictionary <string, IEnumerable <string> > expected)
        {
            Dictionary <string, IEnumerable <string> > actual = MSBPRDependencyGraph.ResolveAssemblyReferenceDependencies(targetProjects);

            Assert.That(actual, Is.EquivalentTo(expected));
        }
コード例 #3
0
        public void CreateDOTGraph(IDictionary <string, IEnumerable <string> > projectReferenceDependencies, MSBPROptions options, string expected)
        {
            string actual = MSBPRDependencyGraph.CreateDOTGraph(projectReferenceDependencies, options);

            Assert.That(actual, Is.EqualTo(expected));
        }