Skip to content

Commit

Permalink
chore(csharp): Add Basic Test for AST Class (#4911)
Browse files Browse the repository at this point in the history
  • Loading branch information
noanflaherty authored Oct 13, 2024
1 parent 1b45b9e commit d397d1b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
33 changes: 33 additions & 0 deletions generators/csharp/codegen/src/ast/__test__/Class.test.ts
Original file line number Diff line number Diff line change
@@ -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<string>(),
allTypeClassReferences: new Map<string, Set<string>>(),
rootNamespace: "",
customConfig: {}
})
).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -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)
{
}
"
`;

0 comments on commit d397d1b

Please sign in to comment.