diff --git a/src/Altinn.App.ModelGenerator.Tests/Altinn.App.ModelGenerator.Tests.csproj b/src/Altinn.App.ModelGenerator.Tests/Altinn.App.ModelGenerator.Tests.csproj
new file mode 100644
index 00000000..8d207c3f
--- /dev/null
+++ b/src/Altinn.App.ModelGenerator.Tests/Altinn.App.ModelGenerator.Tests.csproj
@@ -0,0 +1,31 @@
+
+
+
+ net6.0
+ enable
+
+ false
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
+
+ Always
+
+
+
+
diff --git a/src/Altinn.App.ModelGenerator.Tests/LayoutToModelTests.cs b/src/Altinn.App.ModelGenerator.Tests/LayoutToModelTests.cs
new file mode 100644
index 00000000..370d25bc
--- /dev/null
+++ b/src/Altinn.App.ModelGenerator.Tests/LayoutToModelTests.cs
@@ -0,0 +1,33 @@
+using System.Text.Json;
+using System.Collections.Generic;
+using Altinn.App.ModelGenerator;
+using Xunit;
+
+namespace Altinn.App.ModelGenerator.Tests;
+
+public class LayoutToModelTests
+{
+ [Theory]
+ [FileData("LayoutToModel/FormLayout.json", "LayoutToModel/Summary.json", "LayoutToModel/bindings.json", "LayoutToModel/model.cs")]
+ public void TestGetModelDataBindings(string FormLayout, string summary, string expectedBindings, string expectedModel)
+ {
+ // while (!System.Diagnostics.Debugger.IsAttached)
+ // System.Threading.Thread.Sleep(500);
+ // System.Diagnostics.Debugger.Break();
+
+ var bindings = LayoutToModel.GetDataModelBindings(new string[]{FormLayout, summary});
+ Assert.Equal(JsonSerializer.Deserialize>(expectedBindings), bindings);
+ var generatedModel = LayoutToModel.Convert(bindings, "Altinn.App.Models.Model");
+ Assert.Equal(
+ expectedModel.Replace("\r\n","\n"), //Github actions has configured git to translate LF to CRLF
+ generatedModel);
+ }
+ [Theory]
+ [InlineData("Altinn.App.Models.KRT1226Gjenopprettingsplaner_M", "Altinn.App.Models", "KRT1226Gjenopprettingsplaner_M")]
+ public void TestSplitNamespace(string fullClassName, string expectedNs, string expectedClassName)
+ {
+ var(ns, className) = LayoutToModel.SplitFullClassname(fullClassName);
+ Assert.Equal(expectedNs, ns);
+ Assert.Equal(expectedClassName, className);
+ }
+}
\ No newline at end of file
diff --git a/src/Altinn.App.ModelGenerator.Tests/TestData/FileDataAttribute.cs b/src/Altinn.App.ModelGenerator.Tests/TestData/FileDataAttribute.cs
new file mode 100644
index 00000000..ad5e765a
--- /dev/null
+++ b/src/Altinn.App.ModelGenerator.Tests/TestData/FileDataAttribute.cs
@@ -0,0 +1,20 @@
+using Xunit.Sdk;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Linq;
+
+namespace Altinn.App.ModelGenerator.Tests;
+
+public class FileDataAttribute : DataAttribute
+{
+ private readonly string[] Files;
+ public FileDataAttribute(params string[] files)
+ {
+ Files = files;
+ }
+ public override IEnumerable