Refactor EF tests

This commit is contained in:
Artemy
2025-07-10 18:11:46 +07:00
parent 65a43c09d3
commit d9dfaff079
11 changed files with 49 additions and 9 deletions
+4
View File
@@ -27,4 +27,8 @@
<ProjectReference Include="..\Govor.API\Govor.API.csproj" /> <ProjectReference Include="..\Govor.API\Govor.API.csproj" />
<ProjectReference Include="..\Govor.Data\Govor.Data.csproj" /> <ProjectReference Include="..\Govor.Data\Govor.Data.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="IntegrationTests\EF\Repositories\" />
</ItemGroup>
</Project> </Project>
+30
View File
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoFixture" Version="5.0.0-preview0012" />
<PackageReference Include="coverlet.collector" Version="6.0.2"/>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0"/>
<PackageReference Include="NUnit" Version="4.2.2"/>
<PackageReference Include="NUnit.Analyzers" Version="4.4.0"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0"/>
</ItemGroup>
<ItemGroup>
<Using Include="NUnit.Framework"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Govor.Data\Govor.Data.csproj" />
</ItemGroup>
</Project>
@@ -5,9 +5,8 @@ using Govor.Data;
using Govor.Data.Repositories; using Govor.Data.Repositories;
using Govor.Data.Repositories.Exceptions; using Govor.Data.Repositories.Exceptions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
namespace Govor.API.Tests.IntegrationTests.EF.Repositories; namespace Govor.Data.Tests.Repositories;
[TestFixture] [TestFixture]
public class AdminsRepositoryTests public class AdminsRepositoryTests
@@ -6,7 +6,7 @@ using Govor.Data.Repositories;
using Govor.Data.Repositories.Exceptions; using Govor.Data.Repositories.Exceptions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Govor.API.Tests.IntegrationTests.EF.Repositories; namespace Govor.Data.Tests.Repositories;
[TestFixture] [TestFixture]
public class FriendshipsRepositoryTests public class FriendshipsRepositoryTests
@@ -6,7 +6,7 @@ using Govor.Data.Repositories;
using Govor.Data.Repositories.Exceptions; using Govor.Data.Repositories.Exceptions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Govor.API.Tests.IntegrationTests.EF.Repositories; namespace Govor.Data.Tests.Repositories;
[TestFixture] [TestFixture]
public class GroupRepositoryTests public class GroupRepositoryTests
@@ -6,7 +6,7 @@ using Govor.Data.Repositories;
using Govor.Data.Repositories.Exceptions; using Govor.Data.Repositories.Exceptions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Govor.API.Tests.IntegrationTests.EF.Repositories; namespace Govor.Data.Tests.Repositories;
[TestFixture] [TestFixture]
public class InvitesRepositoryTests public class InvitesRepositoryTests
@@ -6,7 +6,7 @@ using Govor.Data.Repositories;
using Govor.Data.Repositories.Exceptions; using Govor.Data.Repositories.Exceptions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Govor.API.Tests.IntegrationTests.EF.Repositories; namespace Govor.Data.Tests.Repositories;
[TestFixture] [TestFixture]
public class MediaAttachmentsTests public class MediaAttachmentsTests
@@ -6,7 +6,7 @@ using Govor.Data.Repositories;
using Govor.Data.Repositories.Exceptions; using Govor.Data.Repositories.Exceptions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Govor.API.Tests.IntegrationTests.EF.Repositories; namespace Govor.Data.Tests.Repositories;
[TestFixture] [TestFixture]
public class MessagesRepositoryTests public class MessagesRepositoryTests
@@ -6,7 +6,7 @@ using Govor.Data.Repositories;
using Govor.Data.Repositories.Exceptions; using Govor.Data.Repositories.Exceptions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Govor.API.Tests.IntegrationTests.EF.Repositories; namespace Govor.Data.Tests.Repositories;
[TestFixture] [TestFixture]
public class PrivateChatsRepositoryTests public class PrivateChatsRepositoryTests
@@ -6,7 +6,7 @@ using Govor.Data.Repositories;
using Govor.Data.Repositories.Exceptions; using Govor.Data.Repositories.Exceptions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Govor.API.Tests.IntegrationTests.EF.Repositories; namespace Govor.Data.Tests.Repositories;
[TestFixture] [TestFixture]
public class UsersRepositoryTests public class UsersRepositoryTests
+7
View File
@@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Govor.Application", "Govor.
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Govor.Application.Tests", "Govor.Application.Tests\Govor.Application.Tests.csproj", "{F56A64DF-2938-4BE0-83F2-B86429F19259}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Govor.Application.Tests", "Govor.Application.Tests\Govor.Application.Tests.csproj", "{F56A64DF-2938-4BE0-83F2-B86429F19259}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Govor.Data.Tests", "Govor.Data.Tests\Govor.Data.Tests.csproj", "{CF6B23EC-932A-4998-BA95-C94CAB7B092C}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -61,6 +63,10 @@ Global
{F56A64DF-2938-4BE0-83F2-B86429F19259}.Debug|Any CPU.Build.0 = Debug|Any CPU {F56A64DF-2938-4BE0-83F2-B86429F19259}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F56A64DF-2938-4BE0-83F2-B86429F19259}.Release|Any CPU.ActiveCfg = Release|Any CPU {F56A64DF-2938-4BE0-83F2-B86429F19259}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F56A64DF-2938-4BE0-83F2-B86429F19259}.Release|Any CPU.Build.0 = Release|Any CPU {F56A64DF-2938-4BE0-83F2-B86429F19259}.Release|Any CPU.Build.0 = Release|Any CPU
{CF6B23EC-932A-4998-BA95-C94CAB7B092C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF6B23EC-932A-4998-BA95-C94CAB7B092C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF6B23EC-932A-4998-BA95-C94CAB7B092C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF6B23EC-932A-4998-BA95-C94CAB7B092C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{15031CBD-F319-4755-BA91-B86F20BD8E37} = {4ED5259A-6FB4-4D89-8E6B-4778DC68F7D4} {15031CBD-F319-4755-BA91-B86F20BD8E37} = {4ED5259A-6FB4-4D89-8E6B-4778DC68F7D4}
@@ -71,5 +77,6 @@ Global
{4E94907F-BE20-42A6-AB15-637850FEAD11} = {114F53C1-B0AB-4BA0-9E36-0E811D1B3776} {4E94907F-BE20-42A6-AB15-637850FEAD11} = {114F53C1-B0AB-4BA0-9E36-0E811D1B3776}
{FC5EDCA8-FD58-4078-8FB1-2BDBB2F6CA3E} = {114F53C1-B0AB-4BA0-9E36-0E811D1B3776} {FC5EDCA8-FD58-4078-8FB1-2BDBB2F6CA3E} = {114F53C1-B0AB-4BA0-9E36-0E811D1B3776}
{F56A64DF-2938-4BE0-83F2-B86429F19259} = {4ED5259A-6FB4-4D89-8E6B-4778DC68F7D4} {F56A64DF-2938-4BE0-83F2-B86429F19259} = {4ED5259A-6FB4-4D89-8E6B-4778DC68F7D4}
{CF6B23EC-932A-4998-BA95-C94CAB7B092C} = {4ED5259A-6FB4-4D89-8E6B-4778DC68F7D4}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal