diff --git a/src/PlantUml.Builder/ClassDiagrams/StringBuilderExtensions/ClassBase.cs b/src/PlantUml.Builder/ClassDiagrams/StringBuilderExtensions/ClassBase.cs index 4491b81..308df0a 100644 --- a/src/PlantUml.Builder/ClassDiagrams/StringBuilderExtensions/ClassBase.cs +++ b/src/PlantUml.Builder/ClassDiagrams/StringBuilderExtensions/ClassBase.cs @@ -51,7 +51,16 @@ internal static void ClassBase(this StringBuilder stringBuilder, ClassType type, stringBuilder.Append(Constant.Symbols.Space); } - stringBuilder.Append(name); + if (name.Contains(Constant.Symbols.Space)) + { + stringBuilder.Append(Constant.Symbols.Quote); + stringBuilder.Append(name); + stringBuilder.Append(Constant.Symbols.Quote); + } + else + { + stringBuilder.Append(name); + } if (generics is not null) { diff --git a/tests/PlantUml.Builder.Tests/ClassDiagrams/ClassTests.cs b/tests/PlantUml.Builder.Tests/ClassDiagrams/ClassTests.cs index d47709f..5539026 100644 --- a/tests/PlantUml.Builder.Tests/ClassDiagrams/ClassTests.cs +++ b/tests/PlantUml.Builder.Tests/ClassDiagrams/ClassTests.cs @@ -57,6 +57,7 @@ private static IEnumerable GetValidNotations() { // Define the valid notations and expected results for different overloads yield return new object[] { new MethodExpectationTestData("Class", "class classA", "classA") }; + yield return new object[] { new MethodExpectationTestData("Class", "class \"class A\"", "class A") }; yield return new object[] { new MethodExpectationTestData("Class", "class \"Class A\" as classA", "classA", "Class A") }; yield return new object[] { new MethodExpectationTestData("Class", "abstract class classA", "classA", null, true) }; yield return new object[] { new MethodExpectationTestData("Class", "class classA", "classA", null, null, "Object") };