diff --git a/src/HeartTrackAPI/HeartTrackAPI.csproj b/src/HeartTrackAPI/HeartTrackAPI.csproj
index d8fac4c..e815c27 100644
--- a/src/HeartTrackAPI/HeartTrackAPI.csproj
+++ b/src/HeartTrackAPI/HeartTrackAPI.csproj
@@ -14,10 +14,6 @@
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
diff --git a/src/Model2Entities/Model2Entities.csproj b/src/Model2Entities/Model2Entities.csproj
index d298015..d1f7751 100644
--- a/src/Model2Entities/Model2Entities.csproj
+++ b/src/Model2Entities/Model2Entities.csproj
@@ -13,11 +13,4 @@
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
-
diff --git a/src/StubbedContextLib/StubbedContextLib.csproj b/src/StubbedContextLib/StubbedContextLib.csproj
index 0c5f479..1a5589f 100644
--- a/src/StubbedContextLib/StubbedContextLib.csproj
+++ b/src/StubbedContextLib/StubbedContextLib.csproj
@@ -7,14 +7,6 @@
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
-
-
-
diff --git a/src/Tests/ConsoleTestEFMapper/ConsoleTestEFMapper.csproj b/src/Tests/ConsoleTestEFMapper/ConsoleTestEFMapper.csproj
index 1832a20..7c3fdf4 100644
--- a/src/Tests/ConsoleTestEFMapper/ConsoleTestEFMapper.csproj
+++ b/src/Tests/ConsoleTestEFMapper/ConsoleTestEFMapper.csproj
@@ -6,13 +6,6 @@
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
-
Exe
net8.0
diff --git a/src/Tests/ConsoleTestRelationships/ConsoleTestRelationships.csproj b/src/Tests/ConsoleTestRelationships/ConsoleTestRelationships.csproj
index 02f9db5..10252ee 100644
--- a/src/Tests/ConsoleTestRelationships/ConsoleTestRelationships.csproj
+++ b/src/Tests/ConsoleTestRelationships/ConsoleTestRelationships.csproj
@@ -5,13 +5,6 @@
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
-
Exe
net8.0
diff --git a/src/Tests/UnitTestsEntities/ActivityEntityTests.cs b/src/Tests/UnitTestsEntities/ActivityEntityTests.cs
index 62caaae..eadb0dd 100644
--- a/src/Tests/UnitTestsEntities/ActivityEntityTests.cs
+++ b/src/Tests/UnitTestsEntities/ActivityEntityTests.cs
@@ -3,13 +3,14 @@ using Xunit;
using System.Linq;
using Entities;
using Microsoft.EntityFrameworkCore;
+using StubbedContextLib;
+using Microsoft.Data.Sqlite;
-public class ActivityEntityTests
+public class ActivityEntityTests (DatabaseFixture fixture) : IClassFixture
{
[Fact]
public void Add_Activity_Success()
{
-
var activity = new ActivityEntity
{
@@ -29,16 +30,15 @@ public class ActivityEntityTests
DataSourceId = 1,
AthleteId = 1
};
-
/*
- using (var context = new StubbedContext(options))
+ using (var context = new TrainingStubbedContext(fixture._options))
{
context.Database.EnsureCreated();
context.Activities.Add(activity);
context.SaveChanges();
}
- using (var context = new StubbedContext(options))
+ using (var context = new TrainingStubbedContext(options))
{
var savedActivity = context.Activities.First(a => a.Type == "Running");
Assert.NotNull(savedActivity);
diff --git a/src/Tests/UnitTestsEntities/DatabaseFixture.cs b/src/Tests/UnitTestsEntities/DatabaseFixture.cs
new file mode 100644
index 0000000..642d746
--- /dev/null
+++ b/src/Tests/UnitTestsEntities/DatabaseFixture.cs
@@ -0,0 +1,26 @@
+using Microsoft.Data.Sqlite;
+using Microsoft.EntityFrameworkCore;
+using StubbedContextLib;
+
+namespace UnitTestsEntities;
+
+public class DatabaseFixture : IDisposable
+{
+ private readonly SqliteConnection _connection;
+ public readonly DbContextOptions _options;
+ public DatabaseFixture()
+ {
+ _connection = new SqliteConnection("DataSource=:memory:");
+ _connection.Open();
+
+ _options = new DbContextOptionsBuilder()
+ .UseSqlite(_connection)
+ .Options;
+
+ }
+ public void Dispose()
+ {
+ _connection.Close();
+ _connection.Dispose();
+ }
+}
\ No newline at end of file
diff --git a/src/Tests/UnitTestsEntities/UnitTestsEntities.csproj b/src/Tests/UnitTestsEntities/UnitTestsEntities.csproj
index e372137..80251f0 100644
--- a/src/Tests/UnitTestsEntities/UnitTestsEntities.csproj
+++ b/src/Tests/UnitTestsEntities/UnitTestsEntities.csproj
@@ -1,16 +1,20 @@
-
+
net8.0
enable
enable
-
- false
+ $(MSBuildProjectDirectory)
+ false
true
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
@@ -24,7 +28,10 @@
+
+
+