Fix empty body methods

This commit is contained in:
2024-09-23 10:59:25 +02:00
parent 6b2dd46856
commit a2060a7c45
3 changed files with 9 additions and 2 deletions
+7 -1
View File
@@ -34,6 +34,8 @@ public sealed class TestClass<T> : BaseTestClass, IInterface where T : new(), cl
this.fieldString = 0;
return this.fieldString;
}
public string GetSomething();
}";
[TestMethod]
@@ -95,7 +97,11 @@ public sealed class TestClass<T> : BaseTestClass, IInterface where T : new(), cl
.WithTypeParameter(SyntaxBuilder.CreateTypeParameter("T"))
.WithAttribute(SyntaxBuilder.CreateAttribute("SomeAttribute4")
.WithArgument(0.5f))
.WithBody("this.fieldString = 0;\r\nreturn this.fieldString;"))))
.WithBody("this.fieldString = 0;\r\nreturn this.fieldString;"))
.WithMethod(
SyntaxBuilder.CreateMethod("string", "GetSomething")
.WithModifier("public")
.WithNoBody())))
.Build();
var compilationUnit = compilationUnitSyntax.ToFullString();