diff --git a/generators/csharp/codegen/src/ast/__test__/Class.test.ts b/generators/csharp/codegen/src/ast/__test__/Class.test.ts new file mode 100644 index 00000000000..ea365d93a8d --- /dev/null +++ b/generators/csharp/codegen/src/ast/__test__/Class.test.ts @@ -0,0 +1,33 @@ +import { csharp } from "../.."; + +describe("class", () => { + it("basic", async () => { + const clazz = csharp.class_({ + name: "Car", + namespace: "Automotive", + access: "public", + primaryConstructor: { + parameters: [ + csharp.parameter({ + name: "make", + type: csharp.Type.string() + }), + csharp.parameter({ + name: "model", + type: csharp.Type.string() + }) + ], + superClassArguments: [] + } + }); + expect( + clazz.toString({ + namespace: "", + allNamespaceSegments: new Set(), + allTypeClassReferences: new Map>(), + rootNamespace: "", + customConfig: {} + }) + ).toMatchSnapshot(); + }); +}); diff --git a/generators/csharp/codegen/src/ast/__test__/__snapshots__/Class.test.ts.snap b/generators/csharp/codegen/src/ast/__test__/__snapshots__/Class.test.ts.snap new file mode 100644 index 00000000000..5b4872afed6 --- /dev/null +++ b/generators/csharp/codegen/src/ast/__test__/__snapshots__/Class.test.ts.snap @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`class > basic 1`] = ` +"namespace Automotive; + +public class Car(string make,string model) +{ +} +" +`;