немного тестов

This commit is contained in:
2025-02-26 17:15:32 +04:00
parent 66fe491cf6
commit 56af2f0e0a
4 changed files with 48 additions and 0 deletions

View File

@@ -15,5 +15,9 @@
<ItemGroup>
<ProjectReference Include="..\MagicCarpetContracts\MagicCarpetContracts.csproj" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="MagicCarpetTests" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetTests.Infrastructure;
internal class ConfigurationDatabaseTest
{
public string ConnectionString =>
"Host=local;Port=5432;Database=MagicCarpetTest;Username=postgres;Password=postgres;";
}

View File

@@ -21,6 +21,7 @@
<ItemGroup>
<ProjectReference Include="..\MagicCarpetBusinessLogic\MagicCarpetBusinessLogic.csproj" />
<ProjectReference Include="..\MagicCarpetContracts\MagicCarpetContracts.csproj" />
<ProjectReference Include="..\MagicCarpetDatabase\MagicCarpetDatabase.csproj" />
</ItemGroup>
<ItemGroup>

View File

@@ -0,0 +1,30 @@
using MagicCarpetTests.Infrastructure;
using MagicCarpetDatabase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetTests.StoragesContracts;
internal abstract class BaseStorageContractTest
{
protected MagicCarpetDbContext MagicCarpetDbContext { get; private set; }
[OneTimeSetUp]
public void OneTimeSetUp()
{
MagicCarpetDbContext = new MagicCarpetDbContext(new ConfigurationDatabaseTest());
MagicCarpetDbContext.Database.EnsureDeleted();
MagicCarpetDbContext.Database.EnsureCreated();
}
[OneTimeTearDown]
public void OneTimeTearDown()
{
MagicCarpetDbContext.Database.EnsureDeleted();
MagicCarpetDbContext.Dispose();
}
}