Explorar o código

Better test, prettier output

Piotr Czajkowski hai 4 meses
pai
achega
235c05fb00

+ 1 - 4
CodeGenerators/CodeGenerators/ClassRecordGenerator.cs

@@ -35,10 +35,7 @@ public class ClassRecordGenerator : IGenerator
         indent++;
 
         if (Properties.Any())
-        {
-            foreach (var property in Properties)
-                sb.AppendLine(property.Build(indent));
-        }
+            sb.AppendLine(string.Join("\n\n", Properties.Select(x => x.Build(indent))));
 
         indent--;
         sb.AppendLine("}");

+ 4 - 0
CodeGenerators/CodeGeneratorsTests/ClassRecordGeneratorTests.cs

@@ -14,6 +14,10 @@ public class ClassRecordGeneratorTests
         property.Attributes.Add(new AttributeElement("Column", "Test Property"));
         test.Properties.Add(property);
 
+        var secondProperty = new Property("SecondProperty", "int");
+        secondProperty.Attributes.Add(new AttributeElement("Column", "Second Property"));
+        test.Properties.Add(secondProperty);
+
         var result = test.Build();
         Assert.NotEmpty(result);
     }