diff --git a/README.md b/README.md
index 97ec980..4ebd09c 100644
--- a/README.md
+++ b/README.md
@@ -51,11 +51,16 @@ classDiagram
MermaidGraph.NET --> mermaid-graph
class mermaid-graph{
type Exe
- target net9.0
+ target net8.0;net9.0
+ }
+ class Nerdbank.GitVersioning{
+ type NuGet
+ version 3.7.115
}
+ mermaid-graph ..> Nerdbank.GitVersioning
class Microsoft.Build{
type NuGet
- version 17.13.9
+ version 17.11.4
}
mermaid-graph ..> Microsoft.Build
class Microsoft.Build.Locator{
@@ -63,11 +68,6 @@ classDiagram
version 1.9.1
}
mermaid-graph ..> Microsoft.Build.Locator
- class Microsoft.Build.Utilities.Core{
- type NuGet
- version 17.13.9
- }
- mermaid-graph ..> Microsoft.Build.Utilities.Core
class System.CommandLine.DragonFruit{
type NuGet
version 0.4.0-alpha.22272.1
@@ -79,6 +79,11 @@ classDiagram
target net9.0
}
MermaidGraphTests ..> mermaid-graph
+ class Nerdbank.GitVersioning{
+ type NuGet
+ version 3.7.115
+ }
+ MermaidGraphTests ..> Nerdbank.GitVersioning
class coverlet.collector{
type NuGet
version 6.0.4
@@ -129,4 +134,4 @@ classDiagram
version 5.0.0
}
MermaidGraphTests ..> NUnit3TestAdapter
-```
+```
\ No newline at end of file
diff --git a/mermaid-graph/Diagrams/Base/MermaidDiagram.cs b/mermaid-graph/Diagrams/Base/MermaidDiagram.cs
index 2ba3073..6f23450 100644
--- a/mermaid-graph/Diagrams/Base/MermaidDiagram.cs
+++ b/mermaid-graph/Diagrams/Base/MermaidDiagram.cs
@@ -49,7 +49,7 @@ protected MermaidDiagram()
///
/// Initialize the graph output.
///
- public virtual void Header(string title)
+ internal virtual void Header(string title)
{
Graph.Clear();
Graph.AppendLine($"""
@@ -67,7 +67,7 @@ public virtual void Header(string title)
/// Get the mermaid diagram Markdown text.
///
/// The contents of the graph buffer.
- public override string ToString() => Graph.ToString();
+ public sealed override string ToString() => Graph.ToString();
///
public virtual string Project(FileInfo file, string? filter = null, bool excludeNuget = false)
diff --git a/mermaid-graph/Diagrams/ClassDiagram.cs b/mermaid-graph/Diagrams/ClassDiagram.cs
index 70b5645..2d6b6cd 100644
--- a/mermaid-graph/Diagrams/ClassDiagram.cs
+++ b/mermaid-graph/Diagrams/ClassDiagram.cs
@@ -10,7 +10,7 @@ namespace MermaidGraph.Diagrams;
public sealed class ClassDiagram : MermaidDiagram
{
///
- public override void Header(string title)
+ internal override void Header(string title)
{
base.Header(title);
Graph.AppendLine("classDiagram");
@@ -61,8 +61,9 @@ internal override void GraphProject(Project project, string? filter = null, bool
{
var projectName = Path.GetFileNameWithoutExtension(project.FullPath);
var type = project.GetPropertyValue("OutputType");
- var targetFramework = project.GetPropertyValue("TargetFramework") ??
- project.GetPropertyValue("TargetFrameworks");
+ var targetFramework = project.GetPropertyValue("TargetFramework");
+ if (string.IsNullOrEmpty(targetFramework))
+ targetFramework = project.GetPropertyValue("TargetFrameworks");
Graph.AppendLine($$"""
class {{projectName}}{
diff --git a/mermaid-graph/Diagrams/GraphDiagram.cs b/mermaid-graph/Diagrams/GraphDiagram.cs
index df91674..a80dfe6 100644
--- a/mermaid-graph/Diagrams/GraphDiagram.cs
+++ b/mermaid-graph/Diagrams/GraphDiagram.cs
@@ -10,7 +10,7 @@ namespace MermaidGraph.Diagrams;
public sealed class GraphDiagram : MermaidDiagram
{
///
- public override void Header(string title)
+ internal override void Header(string title)
{
base.Header(title);
Graph.AppendLine("graph TD");
diff --git a/mermaid-graph/mermaid-graph.csproj b/mermaid-graph/mermaid-graph.csproj
index 69c7706..004b552 100644
--- a/mermaid-graph/mermaid-graph.csproj
+++ b/mermaid-graph/mermaid-graph.csproj
@@ -2,7 +2,7 @@
Exe
- net9.0
+ net8.0;net9.0
MermaidGraph
enable
enable
@@ -63,7 +63,7 @@
-
+
diff --git a/mermaid-graphTests/CommandsTests.cs b/mermaid-graphTests/CommandsTests.cs
index 1252a0c..62e1416 100644
--- a/mermaid-graphTests/CommandsTests.cs
+++ b/mermaid-graphTests/CommandsTests.cs
@@ -56,6 +56,7 @@ public void DogFoodSolutionTest(DiagramType type, string typeName)
Console.WriteLine(graph);
Assert.That(graph, Is.Not.Null.Or.Empty, "Graph should not be null or empty.");
+ Assert.That(graph, Does.Contain($"title: {info.Name}"));
Assert.That(graph, Does.Contain("mermaid-graph"));
Assert.That(graph, Does.Contain("MermaidGraphTests"));
var graphType = DetectType(ExtractMermaid(graph));
@@ -74,6 +75,7 @@ public void DogFoodProjectTest(DiagramType type, string typeName)
Assert.That(info.Exists);
var graph = Commands.Project(info, type);
Assert.That(graph, Is.Not.Null.Or.Empty, "Graph should not be null or empty.");
+ Assert.That(graph, Does.Contain($"title: {info.Name}"));
Assert.That(graph, Does.Contain("mermaid-graph"));
Assert.That(graph, Does.Contain("MermaidGraphTests"));
Console.WriteLine(graph);
diff --git a/mermaid-graphTests/MermaidDiagramTests.cs b/mermaid-graphTests/MermaidDiagramTests.cs
index 90ea00a..61e7cec 100644
--- a/mermaid-graphTests/MermaidDiagramTests.cs
+++ b/mermaid-graphTests/MermaidDiagramTests.cs
@@ -28,22 +28,4 @@ public void GetDiagramType_ShouldThrowForUnsupportedType()
Assert.Throws(()=>
MermaidDiagram.GetDiagramType((DiagramType)999));
}
-
- [Test]
- [TestCase(DiagramType.Class)]
- [TestCase(DiagramType.Graph)]
- public void Header_ShouldInitializeGraphWithTitle(DiagramType type)
- {
- var diagram = (MermaidDiagram)MermaidDiagram.GetDiagramType(type);
-
- // Arrange
- const string title = "Test Diagram";
-
- // Act
- diagram.Header(title);
-
- // Assert
- Assert.That(diagram.ToString(), Does.Contain($"title: {title}"));
- }
}
-