|
1 | | -using MermaidGraph.Diagrams.Base; |
| 1 | +using System; |
| 2 | +using System.IO; |
| 3 | +using System.Linq; |
| 4 | +using MermaidGraph.Diagrams.Base; |
2 | 5 | using Microsoft.ClearScript.V8; |
3 | 6 | using NUnit.Framework; |
4 | 7 | using Assert = NUnit.Framework.Assert; |
@@ -126,6 +129,63 @@ public void DiagramsShouldNotContainFilteredContent(DiagramType type, string fil |
126 | 129 | $"Graph should not contain filtered content: {filter}"); |
127 | 130 | } |
128 | 131 |
|
| 132 | + [Test] |
| 133 | + [TestCase(DiagramType.Graph)] |
| 134 | + [TestCase(DiagramType.Class)] |
| 135 | + public void Project_ShouldExcludeNuget_WhenExcludeNugetIsTrue(DiagramType type) |
| 136 | + { |
| 137 | + var filePath = FindFileDownTree("*.csproj"); |
| 138 | + Assert.That(filePath, Is.Not.Null); |
| 139 | + var info = new FileInfo(filePath!); |
| 140 | + Assert.That(info.Exists); |
| 141 | + |
| 142 | + var graph = Commands.Project(info, type, excludeNuget: true); |
| 143 | + Assert.That(graph, Does.Not.Contain("NuGet"), "Graph should not contain NuGet references when noNuget is true."); |
| 144 | + } |
| 145 | + |
| 146 | + [Test] |
| 147 | + [TestCase(DiagramType.Graph)] |
| 148 | + [TestCase(DiagramType.Class)] |
| 149 | + public void Solution_ShouldExcludeNuget_WhenExcludeNugetIsTrue(DiagramType type) |
| 150 | + { |
| 151 | + var solutionPath = FindFileDownTree("*.sln"); |
| 152 | + Assert.That(solutionPath, Is.Not.Null); |
| 153 | + var info = new FileInfo(solutionPath!); |
| 154 | + Assert.That(info.Exists); |
| 155 | + |
| 156 | + var graph = Commands.Solution(info, type, excludeNuget: true); |
| 157 | + Assert.That(graph, Does.Not.Contain("NuGet"), "Graph should not contain NuGet references when noNuget is true."); |
| 158 | + } |
| 159 | + |
| 160 | + [Test] |
| 161 | + [TestCase(DiagramType.Graph)] |
| 162 | + [TestCase(DiagramType.Class)] |
| 163 | + public void Project_ShouldIncludeNuget_WhenExcludeNugetIsFalse(DiagramType type) |
| 164 | + { |
| 165 | + var filePath = FindFileDownTree("*.csproj"); |
| 166 | + Assert.That(filePath, Is.Not.Null); |
| 167 | + var info = new FileInfo(filePath!); |
| 168 | + Assert.That(info.Exists); |
| 169 | + |
| 170 | + var graph = Commands.Project(info, type, excludeNuget: false); |
| 171 | + Assert.That(graph, Does.Contain("NuGet"), "Graph should contain NuGet references when noNuget is false."); |
| 172 | + } |
| 173 | + |
| 174 | + [Test] |
| 175 | + [TestCase(DiagramType.Graph)] |
| 176 | + [TestCase(DiagramType.Class)] |
| 177 | + public void Solution_ShouldIncludeNuget_WhenExcludeNugetIsFalse(DiagramType type) |
| 178 | + { |
| 179 | + var solutionPath = FindFileDownTree("*.sln"); |
| 180 | + Assert.That(solutionPath, Is.Not.Null); |
| 181 | + var info = new FileInfo(solutionPath!); |
| 182 | + Assert.That(info.Exists); |
| 183 | + |
| 184 | + var graph = Commands.Solution(info, type, excludeNuget: false); |
| 185 | + Assert.That(graph, Does.Contain("NuGet"), "Graph should contain NuGet references when noNuget is false."); |
| 186 | + } |
| 187 | + |
| 188 | + |
129 | 189 | private static string ExtractMermaid(string? markup) |
130 | 190 | { |
131 | 191 | Assert.That(markup, Does.StartWith(MermaidDiagram.MermaidBegin)); |
|
0 commit comments