refactor (readonly for static objects in tests and file-scoped namespaces
This commit is contained in:
		| @@ -2,17 +2,17 @@ | ||||
| using Microsoft.EntityFrameworkCore.Diagnostics; | ||||
| using DbContext = Infrastructure.Database.DbContext; | ||||
|  | ||||
| namespace VisaApi.Tests.Infrastructure.Database | ||||
| { | ||||
|     public static class InMemoryContextProvider | ||||
|     { | ||||
|         private static DbContextOptions<DbContext> opts = new DbContextOptionsBuilder<DbContext>() | ||||
|         .UseInMemoryDatabase("VisaApiDB") | ||||
|             .ConfigureWarnings(b => b.Ignore(InMemoryEventId.TransactionIgnoredWarning)) | ||||
|             .Options; | ||||
| namespace VisaApi.Tests.Infrastructure.Database; | ||||
|  | ||||
|         public static DbContext GetDbContext() | ||||
|         { | ||||
| public static class InMemoryContextProvider | ||||
| { | ||||
|     private static DbContextOptions<DbContext> opts = new DbContextOptionsBuilder<DbContext>() | ||||
|         .UseInMemoryDatabase("VisaApiDB") | ||||
|         .ConfigureWarnings(b => b.Ignore(InMemoryEventId.TransactionIgnoredWarning)) | ||||
|         .Options; | ||||
|  | ||||
|     public static DbContext GetDbContext() | ||||
|     { | ||||
|             var result = new DbContext(opts); | ||||
|  | ||||
|             result.Database.EnsureDeleted(); | ||||
| @@ -20,5 +20,4 @@ namespace VisaApi.Tests.Infrastructure.Database | ||||
|  | ||||
|             return result; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
| @@ -9,29 +9,29 @@ using VisaApi.Fakers.Users; | ||||
| using VisaApi.Services; | ||||
| using Xunit; | ||||
|  | ||||
| namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
| namespace VisaApi.Tests.Infrastructure.Database.Repositories; | ||||
|  | ||||
| [Collection(Collections.ContextUsingTestCollection)] | ||||
| public class ApplicantsRepositoryTests | ||||
| { | ||||
|     [Collection(Collections.ContextUsingTestCollection)] | ||||
|     public class ApplicantsRepositoryTests | ||||
|     private readonly static UserFaker userFaker = new(); | ||||
|     private readonly static ApplicantFaker applicantFaker = new(GetDateTimeProvider()); | ||||
|  | ||||
|     /// <summary> Returns <see cref="IApplicantsRepository"/> </summary> | ||||
|     /// <param name="context"> Database context </param> | ||||
|     /// <returns>Repository</returns> | ||||
|     private static IApplicantsRepository GetRepository(DbContext context) | ||||
|         => new ApplicantsRepository(context, context); | ||||
|  | ||||
|     /// <summary> Returns <see cref="IDateTimeProvider"/> </summary> | ||||
|     private static IDateTimeProvider GetDateTimeProvider() => new TestDateTimeProvider(); | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IApplicantsRepository.FindByUserIdAsync"/> method that should throw exception for not existing entity | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task FindByUserIdForNotExistingShouldThrow() | ||||
|     { | ||||
|         private readonly static UserFaker userFaker = new(); | ||||
|         private readonly static ApplicantFaker applicantFaker = new(GetDateTimeProvider()); | ||||
|  | ||||
|         /// <summary> Returns <see cref="IApplicantsRepository"/> </summary> | ||||
|         /// <param name="context"> Database context </param> | ||||
|         /// <returns>Repository</returns> | ||||
|         private static IApplicantsRepository GetRepository(DbContext context) | ||||
|             => new ApplicantsRepository(context, context); | ||||
|  | ||||
|         /// <summary> Returns <see cref="IDateTimeProvider"/> </summary> | ||||
|         private static IDateTimeProvider GetDateTimeProvider() => new TestDateTimeProvider(); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IApplicantsRepository.FindByUserIdAsync"/> method that should throw exception for not existing entity | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task FindByUserIdForNotExistingShouldThrow() | ||||
|         { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             ApplicantNotFoundByUserIdException? result = null; | ||||
| @@ -48,12 +48,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().NotBeNull(); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IApplicantsRepository.FindByUserIdAsync"/> method that should return existing entity | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task FindByUserIdForExistingShouldReturnApplicant() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IApplicantsRepository.FindByUserIdAsync"/> method that should return existing entity | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task FindByUserIdForExistingShouldReturnApplicant() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             var user = userFaker.Generate(); | ||||
| @@ -68,12 +68,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().BeEquivalentTo(applicant); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IApplicantsRepository.GetApplicantIdByUserId"/> method that should throw exception for not existing entity | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task GetApplicantIdByUserIdForNotExistingShouldThrow() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IApplicantsRepository.GetApplicantIdByUserId"/> method that should throw exception for not existing entity | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task GetApplicantIdByUserIdForNotExistingShouldThrow() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             ApplicantNotFoundByUserIdException? result = null; | ||||
| @@ -90,12 +90,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().NotBeNull(); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IApplicantsRepository.GetApplicantIdByUserId"/> method that should return existing entity's identifier | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task GetApplicantIdByUserIdForExistingShouldReturnApplicant() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IApplicantsRepository.GetApplicantIdByUserId"/> method that should return existing entity's identifier | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task GetApplicantIdByUserIdForExistingShouldReturnApplicant() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             var user = userFaker.Generate(); | ||||
| @@ -110,12 +110,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().Be(applicant.Id); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IApplicantsRepository.IsApplicantNonResidentByUserId"/> method that should throw exception for not existing entity | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task IsApplicantNonResidentByUserIdForNotExistingShouldThrow() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IApplicantsRepository.IsApplicantNonResidentByUserId"/> method that should throw exception for not existing entity | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task IsApplicantNonResidentByUserIdForNotExistingShouldThrow() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             ApplicantNotFoundByUserIdException? result = null; | ||||
| @@ -132,12 +132,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().NotBeNull(); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IApplicantsRepository.IsApplicantNonResidentByUserId"/> method that should return existing entity's IsNonResident property | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task IsApplicantNonResidentByUserIdForExistingShouldReturnApplicant() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IApplicantsRepository.IsApplicantNonResidentByUserId"/> method that should return existing entity's IsNonResident property | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task IsApplicantNonResidentByUserIdForExistingShouldReturnApplicant() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             var user = userFaker.Generate(); | ||||
| @@ -151,5 +151,4 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|  | ||||
|             result.Should().Be(applicant.IsNonResident); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
| @@ -1,7 +1,6 @@ | ||||
| using Domains.Users; | ||||
| using Infrastructure.Database.Generic; | ||||
|  | ||||
| namespace VisaApi.Tests.Infrastructure.Database.Repositories.Generic | ||||
| { | ||||
|     public class TestGenericRepository(IGenericReader reader, IGenericWriter writer) : GenericRepository<User>(reader, writer); | ||||
| } | ||||
| namespace VisaApi.Tests.Infrastructure.Database.Repositories.Generic; | ||||
|  | ||||
| public class TestGenericRepository(IGenericReader reader, IGenericWriter writer) : GenericRepository<User>(reader, writer); | ||||
| @@ -7,25 +7,25 @@ using Infrastructure.Database.Users.Repositories; | ||||
| using VisaApi.Fakers.Users; | ||||
| using Xunit; | ||||
|  | ||||
| namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
| namespace VisaApi.Tests.Infrastructure.Database.Repositories; | ||||
|  | ||||
| [Collection(Collections.ContextUsingTestCollection)] | ||||
| public class UsersRepositoryTests | ||||
| { | ||||
|     [Collection(Collections.ContextUsingTestCollection)] | ||||
|     public class UsersRepositoryTests | ||||
|     private readonly static UserFaker userFaker = new(); | ||||
|  | ||||
|     /// <summary> Returns <see cref="IVisaApplicationsRepository"/> </summary> | ||||
|     /// <param name="context"> Database context </param> | ||||
|     /// <returns>Repository</returns> | ||||
|     private static IUsersRepository GetRepository(DbContext context) | ||||
|         => new UsersRepository(context, context); | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IUsersRepository.FindByEmailAsync"/> method that should return null for not existing email | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task FindByEmailForNotExistingShouldReturnNull() | ||||
|     { | ||||
|         private readonly static UserFaker userFaker = new(); | ||||
|  | ||||
|         /// <summary> Returns <see cref="IVisaApplicationsRepository"/> </summary> | ||||
|         /// <param name="context"> Database context </param> | ||||
|         /// <returns>Repository</returns> | ||||
|         private static IUsersRepository GetRepository(DbContext context) | ||||
|             => new UsersRepository(context, context); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IUsersRepository.FindByEmailAsync"/> method that should return null for not existing email | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task FindByEmailForNotExistingShouldReturnNull() | ||||
|         { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|  | ||||
| @@ -34,12 +34,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().BeNull(); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IUsersRepository.FindByEmailAsync"/> method that should return entity for existing email | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task FindByEmailForExistingShouldReturnEntity() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IUsersRepository.FindByEmailAsync"/> method that should return entity for existing email | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task FindByEmailForExistingShouldReturnEntity() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             var user = userFaker.Generate(); | ||||
| @@ -51,12 +51,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().Be(user); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IUsersRepository.GetAllOfRoleAsync"/> method that should return empty from empty db | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task GetAllOfRoleForEmptyShouldReturnEmpty() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IUsersRepository.GetAllOfRoleAsync"/> method that should return empty from empty db | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task GetAllOfRoleForEmptyShouldReturnEmpty() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|  | ||||
| @@ -65,12 +65,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().BeEmpty(); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IUsersRepository.GetAllOfRoleAsync"/> method that should return entities from not empty db | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task GetAllOfRoleForNotEmptyShouldReturnEntities() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IUsersRepository.GetAllOfRoleAsync"/> method that should return entities from not empty db | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task GetAllOfRoleForNotEmptyShouldReturnEntities() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             var users = new List<User>(); | ||||
| @@ -88,5 +88,4 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|  | ||||
|             result.Should().Contain(users).And.HaveSameCount(users); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
| @@ -11,30 +11,30 @@ using VisaApi.Fakers.VisaApplications; | ||||
| using VisaApi.Services; | ||||
| using Xunit; | ||||
|  | ||||
| namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
| namespace VisaApi.Tests.Infrastructure.Database.Repositories; | ||||
|  | ||||
| [Collection(Collections.ContextUsingTestCollection)] | ||||
| public class VisaApplicationsRepositoryTests | ||||
| { | ||||
|     [Collection(Collections.ContextUsingTestCollection)] | ||||
|     public class VisaApplicationsRepositoryTests | ||||
|     private readonly static UserFaker userFaker = new(); | ||||
|     private readonly static ApplicantFaker applicantFaker = new(GetDateTimeProvider()); | ||||
|     private readonly static VisaApplicationFaker applicationFaker = new(GetDateTimeProvider()); | ||||
|  | ||||
|     /// <summary> Returns <see cref="IVisaApplicationsRepository"/> </summary> | ||||
|     /// <param name="context"> Database context </param> | ||||
|     /// <returns>Repository</returns> | ||||
|     private static IVisaApplicationsRepository GetRepository(DbContext context) | ||||
|         => new VisaApplicationsRepository(context, context); | ||||
|  | ||||
|     /// <summary> Returns <see cref="IDateTimeProvider"/> </summary> | ||||
|     private static IDateTimeProvider GetDateTimeProvider() => new TestDateTimeProvider(); | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IVisaApplicationsRepository.GetOfApplicantAsync"/> method that should return empty if no applications added | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task GetOfApplicantForEmptyShouldReturnEmpty() | ||||
|     { | ||||
|         private readonly static UserFaker userFaker = new(); | ||||
|         private readonly static ApplicantFaker applicantFaker = new(GetDateTimeProvider()); | ||||
|         private readonly static VisaApplicationFaker applicationFaker = new(GetDateTimeProvider()); | ||||
|  | ||||
|         /// <summary> Returns <see cref="IVisaApplicationsRepository"/> </summary> | ||||
|         /// <param name="context"> Database context </param> | ||||
|         /// <returns>Repository</returns> | ||||
|         private static IVisaApplicationsRepository GetRepository(DbContext context) | ||||
|             => new VisaApplicationsRepository(context, context); | ||||
|  | ||||
|         /// <summary> Returns <see cref="IDateTimeProvider"/> </summary> | ||||
|         private static IDateTimeProvider GetDateTimeProvider() => new TestDateTimeProvider(); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IVisaApplicationsRepository.GetOfApplicantAsync"/> method that should return empty if no applications added | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task GetOfApplicantForEmptyShouldReturnEmpty() | ||||
|         { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             var user = userFaker.Generate(); | ||||
| @@ -49,12 +49,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().BeEmpty(); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IVisaApplicationsRepository.GetOfApplicantAsync"/> method that should return added entities | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task GetOfApplicantForExistingShouldReturnEntities() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IVisaApplicationsRepository.GetOfApplicantAsync"/> method that should return added entities | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task GetOfApplicantForExistingShouldReturnEntities() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             var user = userFaker.Generate(); | ||||
| @@ -77,12 +77,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().Contain(applications).And.HaveSameCount(applications); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IVisaApplicationsRepository.GetByApplicantAndApplicationIdAsync"/> method that should throw exception for not existing entities | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task GetApplicantIdByUserIdForNotExistingShouldThrow() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IVisaApplicationsRepository.GetByApplicantAndApplicationIdAsync"/> method that should throw exception for not existing entities | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task GetApplicantIdByUserIdForNotExistingShouldThrow() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             ApplicationNotFoundByApplicantAndApplicationIdException? result = null; | ||||
| @@ -101,12 +101,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().NotBeNull(); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IVisaApplicationsRepository.GetByApplicantAndApplicationIdAsync"/> method that should throw exception for not existing applicant | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task GetApplicantIdByUserIdForNotExistingApplicantShouldThrow() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IVisaApplicationsRepository.GetByApplicantAndApplicationIdAsync"/> method that should throw exception for not existing applicant | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task GetApplicantIdByUserIdForNotExistingApplicantShouldThrow() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             var user = userFaker.Generate(); | ||||
| @@ -132,12 +132,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().NotBeNull(); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IVisaApplicationsRepository.GetByApplicantAndApplicationIdAsync"/> method that should throw exception for not existing application | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task GetApplicantIdByUserIdForNotExistingApplicationShouldThrow() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IVisaApplicationsRepository.GetByApplicantAndApplicationIdAsync"/> method that should throw exception for not existing application | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task GetApplicantIdByUserIdForNotExistingApplicationShouldThrow() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             var user = userFaker.Generate(); | ||||
| @@ -161,13 +161,13 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().NotBeNull(); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IVisaApplicationsRepository.GetByApplicantAndApplicationIdAsync"/> method | ||||
|         /// that should throw exception for not accessible application | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task GetApplicantIdByUserIdForNotAccessibleApplicationShouldThrow() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IVisaApplicationsRepository.GetByApplicantAndApplicationIdAsync"/> method | ||||
|     /// that should throw exception for not accessible application | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task GetApplicantIdByUserIdForNotAccessibleApplicationShouldThrow() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             var user = userFaker.Generate(); | ||||
| @@ -198,13 +198,13 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().NotBeNull(); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IVisaApplicationsRepository.GetByApplicantAndApplicationIdAsync"/> method | ||||
|         /// that should return application for valid identifiers | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task GetApplicantIdByUserIdForValidIdsShouldReturnApplication() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IVisaApplicationsRepository.GetByApplicantAndApplicationIdAsync"/> method | ||||
|     /// that should return application for valid identifiers | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task GetApplicantIdByUserIdForValidIdsShouldReturnApplication() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             var user = userFaker.Generate(); | ||||
| @@ -222,12 +222,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().Be(application); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IVisaApplicationsRepository.GetPendingApplicationsAsync"/> method that should return empty from empty db | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task GetPendingApplicationsForEmptyShouldReturnEmpty() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IVisaApplicationsRepository.GetPendingApplicationsAsync"/> method that should return empty from empty db | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task GetPendingApplicationsForEmptyShouldReturnEmpty() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|  | ||||
| @@ -236,12 +236,12 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|             result.Should().BeEmpty(); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Test for <see cref="IVisaApplicationsRepository.GetPendingApplicationsAsync"/> method that should return pending applications from not empty db | ||||
|         /// </summary> | ||||
|         [Fact] | ||||
|         private async Task GetPendingApplicationsForExistingShouldReturnExistingPending() | ||||
|         { | ||||
|     /// <summary> | ||||
|     /// Test for <see cref="IVisaApplicationsRepository.GetPendingApplicationsAsync"/> method that should return pending applications from not empty db | ||||
|     /// </summary> | ||||
|     [Fact] | ||||
|     private async Task GetPendingApplicationsForExistingShouldReturnExistingPending() | ||||
|     { | ||||
|             await using var context = InMemoryContextProvider.GetDbContext(); | ||||
|             var repository = GetRepository(context); | ||||
|             var user = userFaker.Generate(); | ||||
| @@ -262,5 +262,4 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories | ||||
|  | ||||
|             result.Should().Contain(applicationPending).And.HaveCount(1); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user