From c4ed7abfbe04370713ca0b99bd6f801ad6664b5a Mon Sep 17 00:00:00 2001
From: "allcontributors[bot]"
<46447321+allcontributors[bot]@users.noreply.github.com>
Date: Fri, 11 Aug 2023 09:07:43 +0200
Subject: [PATCH 1/4] chore: add Ksisa as a contributor for code (#1474)
* update README.md
* update .all-contributorsrc
---------
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
---
.all-contributorsrc | 9 +++++++++
README.md | 3 ++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/.all-contributorsrc b/.all-contributorsrc
index b3a3faae03..7e5cd3c098 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -684,6 +684,15 @@
"contributions": [
"bug"
]
+ },
+ {
+ "login": "Ksisa",
+ "name": "Kristupas",
+ "avatar_url": "https://avatars.githubusercontent.com/u/53404771?v=4",
+ "profile": "https://github.com/Ksisa",
+ "contributions": [
+ "code"
+ ]
}
],
"contributorsPerLine": 7,
diff --git a/README.md b/README.md
index bb7ad754f7..4a3fbffa08 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
[![Discussions](https://img.shields.io/github/discussions/asyncapi/modelina)](https://github.com/asyncapi/modelina/discussions)
[![Website](https://img.shields.io/website?label=website&url=https%3A%2F%2Fwww.modelina.org)](https://www.modelina.org)
[![Playground](https://img.shields.io/website?label=playground&url=https%3A%2F%2Fwww.modelina.org%2Fplayground)](https://www.modelina.org/playground)
-[![All Contributors](https://img.shields.io/badge/all_contributors-62-orange.svg?style=flat-square)](#contributors-)
+[![All Contributors](https://img.shields.io/badge/all_contributors-63-orange.svg?style=flat-square)](#contributors-)
Your one-stop tool for generating accurate and well-tested models for representing the message payloads. Use it as a tool in your development workflow, or a library in a larger integrations, entirely in your control.
@@ -404,6 +404,7 @@ Thanks go out to these wonderful people ([emoji key](https://allcontributors.org
Markus Poerschke 💻 ⚠️ |
James Moey 💻 ⚠️ |
tomwolanski 🐛 |
+ Kristupas 💻 |
From 9b6bf34134d3438ef252a59c80d0039b12633488 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Fran=C3=A7ois=20C=C3=B4t=C3=A9?=
Date: Tue, 15 Aug 2023 16:55:39 -0400
Subject: [PATCH 2/4] fix: problem with json serializer option with C#
generator (#1477)
---
.../__snapshots__/index.spec.ts.snap | 2 +-
.../csharp/presets/JsonSerializerPreset.ts | 6 +++---
.../JsonSerializerPreset.spec.ts.snap | 18 +++++++++---------
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/examples/csharp-generate-json-serializer/__snapshots__/index.spec.ts.snap b/examples/csharp-generate-json-serializer/__snapshots__/index.spec.ts.snap
index 3ae391fac8..ba6cd1f148 100644
--- a/examples/csharp-generate-json-serializer/__snapshots__/index.spec.ts.snap
+++ b/examples/csharp-generate-json-serializer/__snapshots__/index.spec.ts.snap
@@ -65,7 +65,7 @@ internal class RootConverter : JsonConverter
writer.WriteStartObject();
- if(value.Email != null) {
+ if(value.Email != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"email\\");
JsonSerializer.Serialize(writer, value.Email, options);
diff --git a/src/generators/csharp/presets/JsonSerializerPreset.ts b/src/generators/csharp/presets/JsonSerializerPreset.ts
index 578f9b3503..82e6252c49 100644
--- a/src/generators/csharp/presets/JsonSerializerPreset.ts
+++ b/src/generators/csharp/presets/JsonSerializerPreset.ts
@@ -20,7 +20,7 @@ function renderSerializeProperty(
model.property instanceof ConstrainedReferenceModel &&
model.property.ref instanceof ConstrainedEnumModel
) {
- value = `${model.property.type}.GetValue()`;
+ value = `value.${model.property.type}.GetValue()`;
}
return `JsonSerializer.Serialize(writer, ${value}, options);`;
}
@@ -51,7 +51,7 @@ if (${modelInstanceVariable} != null) {
}
}`;
}
- serializeProperties += `if(${modelInstanceVariable} != null) {
+ serializeProperties += `if(${modelInstanceVariable} != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName("${propertyModel.unconstrainedPropertyName}");
${renderSerializeProperty(modelInstanceVariable, propertyModel)}
@@ -123,7 +123,7 @@ function renderDeserializeProperty(model: ConstrainedObjectPropertyModel) {
model.property instanceof ConstrainedReferenceModel &&
model.property.ref instanceof ConstrainedEnumModel
) {
- return `${model.property.name}Extension.To${model.property.name}(JsonSerializer.Deserialize(ref reader, options))`;
+ return `${model.property.name}Extensions.To${model.property.name}(JsonSerializer.Deserialize(ref reader, options))`;
}
return `JsonSerializer.Deserialize<${model.property.type}>(ref reader, options)`;
}
diff --git a/test/generators/csharp/presets/__snapshots__/JsonSerializerPreset.spec.ts.snap b/test/generators/csharp/presets/__snapshots__/JsonSerializerPreset.spec.ts.snap
index 793fc7fed8..b5f12109a8 100644
--- a/test/generators/csharp/presets/__snapshots__/JsonSerializerPreset.spec.ts.snap
+++ b/test/generators/csharp/presets/__snapshots__/JsonSerializerPreset.spec.ts.snap
@@ -85,7 +85,7 @@ internal class TestConverter : JsonConverter
}
if (propertyName == \\"enumProp\\")
{
- var value = EnumTestExtension.ToEnumTest(JsonSerializer.Deserialize(ref reader, options));
+ var value = EnumTestExtensions.ToEnumTest(JsonSerializer.Deserialize(ref reader, options));
instance.EnumProp = value;
continue;
}
@@ -114,22 +114,22 @@ internal class TestConverter : JsonConverter
writer.WriteStartObject();
- if(value.StringProp != null) {
+ if(value.StringProp != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"string prop\\");
JsonSerializer.Serialize(writer, value.StringProp, options);
}
- if(value.NumberProp != null) {
+ if(value.NumberProp != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"numberProp\\");
JsonSerializer.Serialize(writer, value.NumberProp, options);
}
- if(value.EnumProp != null) {
+ if(value.EnumProp != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"enumProp\\");
- JsonSerializer.Serialize(writer, EnumTest?.GetValue(), options);
+ JsonSerializer.Serialize(writer, value.EnumTest?.GetValue(), options);
}
- if(value.ObjectProp != null) {
+ if(value.ObjectProp != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"objectProp\\");
JsonSerializer.Serialize(writer, value.ObjectProp, options);
@@ -147,7 +147,7 @@ internal class TestConverter : JsonConverter
writer.WritePropertyName(unwrappedProperty.Key);
JsonSerializer.Serialize(writer, unwrappedProperty.Value, options);
}
- }if(value.AdditionalProperties != null) {
+ }if(value.AdditionalProperties != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"additionalProperties\\");
JsonSerializer.Serialize(writer, value.AdditionalProperties, options);
@@ -274,7 +274,7 @@ internal class NestedTestConverter : JsonConverter
writer.WriteStartObject();
- if(value.StringProp != null) {
+ if(value.StringProp != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"stringProp\\");
JsonSerializer.Serialize(writer, value.StringProp, options);
@@ -292,7 +292,7 @@ internal class NestedTestConverter : JsonConverter
writer.WritePropertyName(unwrappedProperty.Key);
JsonSerializer.Serialize(writer, unwrappedProperty.Value, options);
}
- }if(value.AdditionalProperties != null) {
+ }if(value.AdditionalProperties != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"additionalProperties\\");
JsonSerializer.Serialize(writer, value.AdditionalProperties, options);
From 1cb0783838cb68329c881ce1c2b9fc708600deec Mon Sep 17 00:00:00 2001
From: asyncapi-bot
Date: Tue, 15 Aug 2023 23:19:57 +0200
Subject: [PATCH 3/4] chore(release): v1.8.11 (#1478)
---
package-lock.json | 4 ++--
package.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 8badfbe900..701ed3effd 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@asyncapi/modelina",
- "version": "1.8.10",
+ "version": "1.8.11",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@asyncapi/modelina",
- "version": "1.8.10",
+ "version": "1.8.11",
"license": "Apache-2.0",
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^9.0.9",
diff --git a/package.json b/package.json
index 6fc185b6fd..761e6b2ca3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@asyncapi/modelina",
- "version": "1.8.10",
+ "version": "1.8.11",
"description": "Library for generating data models based on inputs such as AsyncAPI, OpenAPI, or JSON Schema documents",
"license": "Apache-2.0",
"homepage": "https://www.modelina.org",
From 627ed974e1efab793bd78b91b9046e63c27012cb Mon Sep 17 00:00:00 2001
From: Jonas Lagoni
Date: Tue, 22 Aug 2023 16:44:20 +0200
Subject: [PATCH 4/4] test: add initial C# runtime testing (#1481)
add initial setup
---
.github/workflows/runtime-csharp-testing.yml | 43 ++
package.json | 2 +
test/runtime/runtime-csharp.spec.ts | 12 +
test/runtime/runtime-csharp.ts | 17 +
test/runtime/runtime-csharp/.gitignore | 402 ++++++++++++++++++
.../runtime/runtime-csharp/runtime-csharp.sln | 25 ++
.../runtime-csharp/runtime-csharp/README.md | 8 +
.../runtime-csharp/runtime-csharp/Usings.cs | 1 +
.../runtime-csharp/runtime-csharp.csproj | 36 ++
.../test/models/json_serializer/Address.cs | 31 ++
10 files changed, 577 insertions(+)
create mode 100644 .github/workflows/runtime-csharp-testing.yml
create mode 100644 test/runtime/runtime-csharp.spec.ts
create mode 100644 test/runtime/runtime-csharp.ts
create mode 100644 test/runtime/runtime-csharp/.gitignore
create mode 100644 test/runtime/runtime-csharp/runtime-csharp.sln
create mode 100644 test/runtime/runtime-csharp/runtime-csharp/README.md
create mode 100644 test/runtime/runtime-csharp/runtime-csharp/Usings.cs
create mode 100644 test/runtime/runtime-csharp/runtime-csharp/runtime-csharp.csproj
create mode 100644 test/runtime/runtime-csharp/runtime-csharp/test/models/json_serializer/Address.cs
diff --git a/.github/workflows/runtime-csharp-testing.yml b/.github/workflows/runtime-csharp-testing.yml
new file mode 100644
index 0000000000..00d06de58f
--- /dev/null
+++ b/.github/workflows/runtime-csharp-testing.yml
@@ -0,0 +1,43 @@
+name: Runtime Testing C# Models
+on:
+ push:
+ pull_request:
+ types: [opened, synchronize, reopened, ready_for_review]
+ paths:
+ - 'src/generators/csharp/**'
+ - 'test/runtime/runtime-csharp/**'
+ - 'test/runtime/**csharp**'
+
+jobs:
+ test:
+ name: Runtime Testing C# Models
+ if: "github.event.pull_request.draft == false &&!((github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'ci: update global workflows')) || (github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'chore(release):')) || (github.actor == 'allcontributors' && startsWith(github.event.pull_request.title, 'docs: add')))"
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v3
+ - name: Check package-lock version
+ uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
+ id: lockversion
+ - name: Setup Node.js
+ uses: actions/setup-node@v3
+ with:
+ node-version: "${{ steps.lockversion.outputs.version }}"
+ cache: 'npm'
+ cache-dependency-path: '**/package-lock.json'
+ - if: matrix.os != 'windows-latest'
+ name: Setup dotnet
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: '6.0.x'
+ - if: matrix.os == 'windows-latest'
+ name: Setup csc.exe
+ uses: yoavain/Setup-CSC@v7
+ - name: Build library
+ run: npm install && npm run build:prod
+ - name: Generate C# models
+ run: npm run generate:runtime:csharp
+ - name: Run runtime tests
+ run: npm run test:runtime:csharp
+
+
diff --git a/package.json b/package.json
index 761e6b2ca3..603900ca84 100644
--- a/package.json
+++ b/package.json
@@ -110,6 +110,8 @@
"generate:runtime:php": "cross-env CI=true ts-node ./test/runtime/runtime-php.ts",
"test:runtime:typescript": "cd ./test/runtime/runtime-typescript && npm i && npm run test",
"generate:runtime:typescript": "cross-env CI=true ts-node ./test/runtime/runtime-typescript.ts",
+ "test:runtime:csharp": "cross-env CI=true jest ./test/runtime/runtime-csharp.spec.ts",
+ "generate:runtime:csharp": "cross-env CI=true ts-node ./test/runtime/runtime-csharp.ts",
"test:watch": "jest --watch",
"docs": "npm run docs:api",
"docs:api": "typedoc src/index.ts --out ./modelina-website/public/docs/api/generated --name Modelina",
diff --git a/test/runtime/runtime-csharp.spec.ts b/test/runtime/runtime-csharp.spec.ts
new file mode 100644
index 0000000000..fdd8279c2e
--- /dev/null
+++ b/test/runtime/runtime-csharp.spec.ts
@@ -0,0 +1,12 @@
+import { execCommand } from '../blackbox/utils/Utils';
+import path from 'path';
+
+jest.setTimeout(50000);
+
+test('C# runtime testing', async () => {
+ const compileCommand = `cd ${path.resolve(
+ __dirname,
+ './runtime-csharp'
+ )} && dotnet test runtime-csharp`;
+ await execCommand(compileCommand);
+});
diff --git a/test/runtime/runtime-csharp.ts b/test/runtime/runtime-csharp.ts
new file mode 100644
index 0000000000..97f5c1c441
--- /dev/null
+++ b/test/runtime/runtime-csharp.ts
@@ -0,0 +1,17 @@
+import { CSHARP_JSON_SERIALIZER_PRESET, CSharpFileGenerator } from '../../';
+import path from 'path';
+import input from './generic-input.json';
+
+const generator = new CSharpFileGenerator({
+ presets: [CSHARP_JSON_SERIALIZER_PRESET]
+});
+
+generator.generateToFiles(
+ input,
+ path.resolve(
+ // eslint-disable-next-line no-undef
+ __dirname,
+ './runtime-csharp/runtime-csharp/src/models/json_serializer'
+ ),
+ { namespace: 'com.mycompany.app.generic' }
+);
diff --git a/test/runtime/runtime-csharp/.gitignore b/test/runtime/runtime-csharp/.gitignore
new file mode 100644
index 0000000000..0fc0c43bd6
--- /dev/null
+++ b/test/runtime/runtime-csharp/.gitignore
@@ -0,0 +1,402 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.tlog
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio 6 auto-generated project file (contains which files were open etc.)
+*.vbp
+
+# Visual Studio 6 workspace and project file (working project files containing files to include in project)
+*.dsw
+*.dsp
+
+# Visual Studio 6 technical files
+*.ncb
+*.aps
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# Visual Studio History (VSHistory) files
+.vshistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
+
+# VS Code files for those working on multiple tools
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+# Windows Installer files from build outputs
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# JetBrains Rider
+*.sln.iml
+
+
+## Ignore auto-generated src code
+src/
\ No newline at end of file
diff --git a/test/runtime/runtime-csharp/runtime-csharp.sln b/test/runtime/runtime-csharp/runtime-csharp.sln
new file mode 100644
index 0000000000..28e236a111
--- /dev/null
+++ b/test/runtime/runtime-csharp/runtime-csharp.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 25.0.1703.8
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "runtime-csharp", "runtime-csharp\runtime-csharp.csproj", "{5474C3FC-151F-4CEF-AB62-49D964E86EC9}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {5474C3FC-151F-4CEF-AB62-49D964E86EC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5474C3FC-151F-4CEF-AB62-49D964E86EC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5474C3FC-151F-4CEF-AB62-49D964E86EC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5474C3FC-151F-4CEF-AB62-49D964E86EC9}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {5B2C6F52-B721-417A-A1DF-DBE8592A3294}
+ EndGlobalSection
+EndGlobal
diff --git a/test/runtime/runtime-csharp/runtime-csharp/README.md b/test/runtime/runtime-csharp/runtime-csharp/README.md
new file mode 100644
index 0000000000..460f52fe71
--- /dev/null
+++ b/test/runtime/runtime-csharp/runtime-csharp/README.md
@@ -0,0 +1,8 @@
+# Modelina C# Runtime project
+
+This is the Modelina C# runtime project that is used to test the C#-generated code from Modelina at runtime to ensure that everything works as expected.
+
+Here is how it works:
+- The models are first generated during the build phase of the project, by running the root npm script `npm run generate:runtime:csharp`. These models are pre-defined with the [generic input](../generic-input.json).
+- The tests are manually added and changed.
+- When the project is tested, it tests the generated models at runtime for semantic errors.
\ No newline at end of file
diff --git a/test/runtime/runtime-csharp/runtime-csharp/Usings.cs b/test/runtime/runtime-csharp/runtime-csharp/Usings.cs
new file mode 100644
index 0000000000..9a28bd89e2
--- /dev/null
+++ b/test/runtime/runtime-csharp/runtime-csharp/Usings.cs
@@ -0,0 +1 @@
+global using NUnit.Framework;
diff --git a/test/runtime/runtime-csharp/runtime-csharp/runtime-csharp.csproj b/test/runtime/runtime-csharp/runtime-csharp/runtime-csharp.csproj
new file mode 100644
index 0000000000..7cb79cdc30
--- /dev/null
+++ b/test/runtime/runtime-csharp/runtime-csharp/runtime-csharp.csproj
@@ -0,0 +1,36 @@
+
+
+
+ net6.0
+ runtime_csharp
+ enable
+ enable
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/runtime/runtime-csharp/runtime-csharp/test/models/json_serializer/Address.cs b/test/runtime/runtime-csharp/runtime-csharp/test/models/json_serializer/Address.cs
new file mode 100644
index 0000000000..4275e8d7d7
--- /dev/null
+++ b/test/runtime/runtime-csharp/runtime-csharp/test/models/json_serializer/Address.cs
@@ -0,0 +1,31 @@
+using System.Text.Json;
+using com.mycompany.app.generic;
+
+namespace runtime_csharp;
+
+public class AddressTests
+{
+
+ [SetUp]
+ public void Setup()
+ {
+ }
+
+ [Test]
+ public void TestSerializingFullModel()
+ {
+ Address address = new Address();
+ NestedObject nestedObject = new NestedObject();
+ nestedObject.Test = "test";
+ address.NestedObject = nestedObject;
+ address.StreetName = "test";
+ address.Marriage = true;
+ address.Members = 2;
+ address.HouseNumber = 1;
+ address.ArrayType = new dynamic[] { 1, "test" };
+ string actualJsonString = JsonSerializer.Serialize(address);
+ string expectedJsonString = "{\"street_name\":\"test\",\"house_number\":1,\"marriage\":true,\"members\":2,\"array_type\":[1,\"test\"],\"nestedObject\":{\"test\":\"test\"}}";
+ Assert.That(actualJsonString, Is.EqualTo(expectedJsonString));
+ }
+}
+