diff --git a/src/Nox.Generator.sln b/src/Nox.Generator.sln
index ebf43b7333..21b31cfc98 100644
--- a/src/Nox.Generator.sln
+++ b/src/Nox.Generator.sln
@@ -57,6 +57,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nox.EntityFramework.Sqlite"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Generator", "Generator", "{154B838E-65DE-479F-80B7-D48CF9862306}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nox.Tests", "..\tests\Nox.Tests\Nox.Tests.csproj", "{749A8B24-397E-4794-B647-3557E19FBA41}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -135,6 +137,10 @@ Global
{049C94B7-EC09-4511-B6BC-21DE2C9C54E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{049C94B7-EC09-4511-B6BC-21DE2C9C54E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{049C94B7-EC09-4511-B6BC-21DE2C9C54E1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {749A8B24-397E-4794-B647-3557E19FBA41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {749A8B24-397E-4794-B647-3557E19FBA41}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {749A8B24-397E-4794-B647-3557E19FBA41}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {749A8B24-397E-4794-B647-3557E19FBA41}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/tests/Nox.Tests/CodeAnalysisSolutionFixture.cs b/tests/Nox.Tests/CodeAnalysisSolutionFixture.cs
new file mode 100644
index 0000000000..9903de9fbb
--- /dev/null
+++ b/tests/Nox.Tests/CodeAnalysisSolutionFixture.cs
@@ -0,0 +1,53 @@
+using System.Reflection;
+using Microsoft.Build.Locator;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.MSBuild;
+
+namespace Nox.Tests;
+
+public class CodeAnalysisSolutionFixture : IAsyncLifetime
+{
+ private const string SolutionPath = "src/Nox.Generator.sln";
+
+ public Solution Solution { get; private set; } = null!;
+ public Project NoxTypesProject { get; private set; } = null!;
+ public Project NoxSolutionNet7 { get; private set; } = null!;
+ public Project NoxSolutionNetStd20 { get; private set; } = null!;
+
+ public async Task InitializeAsync()
+ {
+ MSBuildLocator.RegisterDefaults();
+
+ var workspace = MSBuildWorkspace.Create();
+
+ Solution = await workspace.OpenSolutionAsync(GetSolutionFile());
+
+ NoxTypesProject = Solution.Projects.Single(project => project.Name == "Nox.Types");
+ NoxSolutionNet7 = Solution.Projects.Single(project => project.Name == "Nox.Solution(net7.0)");
+ NoxSolutionNetStd20 = Solution.Projects.Single(project => project.Name == "Nox.Solution(netstandard2.0)");
+ }
+
+ public Task DisposeAsync()
+ {
+ return Task.CompletedTask;
+ }
+ private string GetSolutionFile()
+ {
+ return GetSolutionFile(Directory.GetParent(Assembly.GetExecutingAssembly().Location));
+ }
+
+ private string GetSolutionFile(DirectoryInfo? directoryInfo)
+ {
+ if (directoryInfo == null)
+ throw new Exception($"Could not find solution {SolutionPath}");
+
+ var filePath = Path.Combine(directoryInfo.FullName, SolutionPath);
+
+ if (File.Exists(filePath))
+ {
+ return filePath;
+ }
+
+ return GetSolutionFile(directoryInfo.Parent);
+ }
+}
\ No newline at end of file
diff --git a/tests/Nox.Tests/Nox.Tests.csproj b/tests/Nox.Tests/Nox.Tests.csproj
new file mode 100644
index 0000000000..b9f23000d1
--- /dev/null
+++ b/tests/Nox.Tests/Nox.Tests.csproj
@@ -0,0 +1,29 @@
+
+
+
+ net7.0
+ enable
+ enable
+
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
diff --git a/tests/Nox.Tests/ProjectsDependenciesTests.cs b/tests/Nox.Tests/ProjectsDependenciesTests.cs
new file mode 100644
index 0000000000..c0e52693f4
--- /dev/null
+++ b/tests/Nox.Tests/ProjectsDependenciesTests.cs
@@ -0,0 +1,29 @@
+using FluentAssertions;
+
+namespace Nox.Tests
+{
+ public class ProjectsDependenciesTests: IClassFixture
+ {
+ private readonly CodeAnalysisSolutionFixture _fixture;
+
+ public ProjectsDependenciesTests(CodeAnalysisSolutionFixture fixture)
+ {
+ _fixture = fixture;
+ }
+
+ [Fact]
+ public void Nox_Types_Cannot_Reference_Projects()
+ {
+ _fixture.NoxTypesProject.ProjectReferences.Should().BeEmpty();
+ }
+ [Fact]
+ public void Nox_Types__References_Nox_Types_Only()
+ {
+ _fixture.NoxSolutionNet7.ProjectReferences.Count().Should().Be(1);
+ _fixture.NoxSolutionNetStd20.ProjectReferences.Count().Should().Be(1);
+
+ (_fixture.NoxSolutionNet7.ProjectReferences.Single().ProjectId == _fixture.NoxTypesProject.Id).Should().BeTrue();
+ (_fixture.NoxSolutionNetStd20.ProjectReferences.Single().ProjectId == _fixture.NoxTypesProject.Id).Should().BeTrue();
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/Nox.Tests/Usings.cs b/tests/Nox.Tests/Usings.cs
new file mode 100644
index 0000000000..8c927eb747
--- /dev/null
+++ b/tests/Nox.Tests/Usings.cs
@@ -0,0 +1 @@
+global using Xunit;
\ No newline at end of file