refactor (readonly for static objects in tests and file-scoped namespaces
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ApplicationLayer
|
||||
{
|
||||
namespace ApplicationLayer;
|
||||
|
||||
public static class Constants
|
||||
{
|
||||
public readonly static Regex EnglishWordRegex = new("^[a-zA-Z]*$");
|
||||
@@ -10,4 +10,3 @@ namespace ApplicationLayer
|
||||
|
||||
public readonly static Regex PhoneNumRegex = new(@"^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ApplicationLayer.Services.AuthServices.Common
|
||||
{
|
||||
namespace ApplicationLayer.Services.AuthServices.Common;
|
||||
|
||||
public class AuthToken
|
||||
{
|
||||
[Required] public string Token { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Domains;
|
||||
|
||||
namespace ApplicationLayer.Services.Users.Models
|
||||
{
|
||||
namespace ApplicationLayer.Services.Users.Models;
|
||||
|
||||
/// Auth data with nullable password for making change auth data requests
|
||||
public class ChangeAuthData
|
||||
{
|
||||
@@ -13,4 +13,3 @@ namespace ApplicationLayer.Services.Users.Models
|
||||
[MaxLength(ConfigurationConstraints.PasswordLength)]
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Domains;
|
||||
|
||||
namespace ApplicationLayer.Services.Users.Models
|
||||
{
|
||||
namespace ApplicationLayer.Services.Users.Models;
|
||||
|
||||
public class UserModel
|
||||
{
|
||||
/// Unique Identifier of user
|
||||
@@ -13,4 +13,3 @@ namespace ApplicationLayer.Services.Users.Models
|
||||
[MaxLength(ConfigurationConstraints.EmailLength)]
|
||||
public string Email { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Domains;
|
||||
using FluentValidation;
|
||||
|
||||
namespace ApplicationLayer.Services.Users.Requests.Validation
|
||||
{
|
||||
namespace ApplicationLayer.Services.Users.Requests.Validation;
|
||||
|
||||
public class ChangeUserAuthDataRequestValidator : AbstractValidator<ChangeUserAuthDataRequest>
|
||||
{
|
||||
public ChangeUserAuthDataRequestValidator()
|
||||
@@ -21,4 +21,3 @@ namespace ApplicationLayer.Services.Users.Requests.Validation
|
||||
.WithMessage($"Email address length must be less than {ConfigurationConstraints.EmailLength}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
namespace BlazorWebAssemblyVisaApiClient.Common.Exceptions
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Common.Exceptions;
|
||||
|
||||
public class BlazorClientException(string message) : Exception(message);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
namespace BlazorWebAssemblyVisaApiClient.Common.Exceptions
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Common.Exceptions;
|
||||
|
||||
public class NotLoggedInException() : BlazorClientException("User is not logged in.");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace BlazorWebAssemblyVisaApiClient
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient;
|
||||
|
||||
public static class Constants
|
||||
{
|
||||
public readonly static Regex EnglishWordRegex = new("^[a-zA-Z]*$");
|
||||
@@ -17,4 +17,3 @@ namespace BlazorWebAssemblyVisaApiClient
|
||||
public const string ApprovingAuthorityRole = "ApprovingAuthority";
|
||||
public const string AdminRole = "Admin";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ using BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models;
|
||||
using VisaApiClient;
|
||||
using PlaceOfWorkModel = BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models.PlaceOfWorkModel;
|
||||
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.AutoMapper.Profiles
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.AutoMapper.Profiles;
|
||||
|
||||
public class RegisterApplicantRequestProfile : Profile
|
||||
{
|
||||
public RegisterApplicantRequestProfile()
|
||||
@@ -16,4 +16,3 @@ namespace BlazorWebAssemblyVisaApiClient.Infrastructure.AutoMapper.Profiles
|
||||
CreateMap<PlaceOfWorkModel, VisaApiClient.PlaceOfWorkModel>(MemberList.Destination);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using BlazorWebAssemblyVisaApiClient.Validation.VisaApplications.Models;
|
||||
using VisaApiClient;
|
||||
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.AutoMapper.Profiles
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.AutoMapper.Profiles;
|
||||
|
||||
public class VisaApplicationCreateRequestProfile : Profile
|
||||
{
|
||||
public VisaApplicationCreateRequestProfile()
|
||||
@@ -11,4 +11,3 @@ namespace BlazorWebAssemblyVisaApiClient.Infrastructure.AutoMapper.Profiles
|
||||
CreateMap<VisaApplicationCreateRequestModel, VisaApplicationCreateRequest>(MemberList.Destination);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers;
|
||||
|
||||
public static class EnumExtensions
|
||||
{
|
||||
public static string GetDisplayName(this Enum value)
|
||||
@@ -15,4 +15,3 @@ namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Text;
|
||||
using FluentValidation.Results;
|
||||
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers;
|
||||
|
||||
public static class ValidationResultExtensions
|
||||
{
|
||||
public static string ToErrorsString(this ValidationResult validationResult)
|
||||
@@ -19,4 +19,3 @@ namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Services.DateTimeProvider
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Services.DateTimeProvider;
|
||||
|
||||
public class DateTimeProvider : IDateTimeProvider
|
||||
{
|
||||
public DateTime Now() => DateTime.Now;
|
||||
|
||||
public string FormattedNow() => Now().ToString("yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Services.DateTimeProvider
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Services.DateTimeProvider;
|
||||
|
||||
public interface IDateTimeProvider
|
||||
{
|
||||
DateTime Now();
|
||||
|
||||
string FormattedNow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using BlazorWebAssemblyVisaApiClient.Common.Exceptions;
|
||||
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider.Exceptions
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider.Exceptions;
|
||||
|
||||
public class UnknownRoleException() : BlazorClientException("Unknown user role");
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using VisaApiClient;
|
||||
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider;
|
||||
|
||||
public interface IUserDataProvider
|
||||
{
|
||||
public string? CurrentRole { get; }
|
||||
@@ -12,4 +12,3 @@ namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvide
|
||||
|
||||
public void UpdateCurrentRole();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ using System.Security.Claims;
|
||||
using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider.Exceptions;
|
||||
using VisaApiClient;
|
||||
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider;
|
||||
|
||||
public class UserDataProvider(Client client) : IUserDataProvider
|
||||
{
|
||||
private readonly static JwtSecurityTokenHandler tokenHandler = new();
|
||||
@@ -50,4 +50,3 @@ namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvide
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using VisaApiClient;
|
||||
|
||||
namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models;
|
||||
|
||||
/// Model of place of work with attributes required for validation to work
|
||||
public class PlaceOfWorkModel
|
||||
{
|
||||
@@ -18,4 +18,3 @@ namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models
|
||||
[StringLength(ConfigurationConstraints.PhoneNumberLength, MinimumLength = ConfigurationConstraints.PhoneNumberMinLength)]
|
||||
public string PhoneNum { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using VisaApiClient;
|
||||
|
||||
namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models;
|
||||
|
||||
/// Model of request with attributes required for validation to work
|
||||
public class RegisterApplicantRequestModel
|
||||
{
|
||||
@@ -65,4 +65,3 @@ namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models
|
||||
|
||||
public bool IsNonResident { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using VisaApiClient;
|
||||
|
||||
namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models;
|
||||
|
||||
/// Model of request with attributes required for validation to work
|
||||
public class RegisterRequestModel
|
||||
{
|
||||
@@ -10,4 +10,3 @@ namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models
|
||||
[ValidateComplexType]
|
||||
public AuthData AuthData { get; set; } = new AuthData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using FluentValidation;
|
||||
using VisaApiClient;
|
||||
|
||||
namespace BlazorWebAssemblyVisaApiClient.Validation.Auth
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Validation.Auth;
|
||||
|
||||
public class ChangeUserAuthDataRequestValidator : AbstractValidator<ChangeUserAuthDataRequest>
|
||||
{
|
||||
public ChangeUserAuthDataRequestValidator()
|
||||
@@ -18,4 +18,3 @@ namespace BlazorWebAssemblyVisaApiClient.Validation.Auth
|
||||
.WithMessage($"Email address length must be less than {ConfigurationConstraints.EmailLength}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using VisaApiClient;
|
||||
|
||||
namespace BlazorWebAssemblyVisaApiClient.Validation.VisaApplications.Models
|
||||
{
|
||||
namespace BlazorWebAssemblyVisaApiClient.Validation.VisaApplications.Models;
|
||||
|
||||
/// Model for request for data annotations validation to work
|
||||
public class VisaApplicationCreateRequestModel
|
||||
{
|
||||
@@ -35,4 +35,3 @@ namespace BlazorWebAssemblyVisaApiClient.Validation.VisaApplications.Models
|
||||
[ValidateComplexType]
|
||||
public List<PastVisitModel> PastVisits { get; set; } = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Text;
|
||||
|
||||
namespace VisaApiClient
|
||||
{
|
||||
namespace VisaApiClient;
|
||||
|
||||
public class ClientBase
|
||||
{
|
||||
public AuthToken? AuthToken { get; set; }
|
||||
@@ -27,4 +27,3 @@ namespace VisaApiClient
|
||||
protected async Task ProcessResponseAsync(HttpClient client, HttpResponseMessage response, CancellationToken cancellationToken)
|
||||
=> await Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace VisaApi
|
||||
{
|
||||
namespace VisaApi;
|
||||
|
||||
public static class Collections
|
||||
{
|
||||
public const string ContextUsingTestCollection = "ContextUsingTestCollection";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ using Bogus;
|
||||
using Domains;
|
||||
using Domains.ApplicantDomain;
|
||||
|
||||
namespace VisaApi.Fakers.Applicants
|
||||
{
|
||||
namespace VisaApi.Fakers.Applicants;
|
||||
|
||||
/// <summary>
|
||||
/// Generates applicants
|
||||
/// </summary>
|
||||
@@ -63,4 +63,3 @@ namespace VisaApi.Fakers.Applicants
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using ApplicationLayer.Services.Applicants.Models;
|
||||
using Bogus;
|
||||
|
||||
namespace VisaApi.Fakers.Applicants.Requests
|
||||
{
|
||||
namespace VisaApi.Fakers.Applicants.Requests;
|
||||
|
||||
public sealed class NameModelFaker : Faker<NameModel>
|
||||
{
|
||||
public NameModelFaker()
|
||||
@@ -14,4 +14,3 @@ namespace VisaApi.Fakers.Applicants.Requests
|
||||
RuleFor(m => m.Patronymic, f => f.Name.FirstName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ using ApplicationLayer.Services.Applicants.Models;
|
||||
using Bogus;
|
||||
using Domains;
|
||||
|
||||
namespace VisaApi.Fakers.Applicants.Requests
|
||||
{
|
||||
namespace VisaApi.Fakers.Applicants.Requests;
|
||||
|
||||
public sealed class PassportModelFaker : Faker<PassportModel>
|
||||
{
|
||||
public PassportModelFaker(IDateTimeProvider dateTimeProvider)
|
||||
@@ -21,4 +21,3 @@ namespace VisaApi.Fakers.Applicants.Requests
|
||||
f => f.Date.Past(4, dateTimeProvider.Now()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ using ApplicationLayer.Services.Applicants.Models;
|
||||
using Bogus;
|
||||
using Domains.ApplicantDomain;
|
||||
|
||||
namespace VisaApi.Fakers.Applicants.Requests
|
||||
{
|
||||
namespace VisaApi.Fakers.Applicants.Requests;
|
||||
|
||||
public sealed class PlaceOfWorkModelFaker : Faker<PlaceOfWorkModel>
|
||||
{
|
||||
public PlaceOfWorkModelFaker()
|
||||
@@ -22,4 +22,3 @@ namespace VisaApi.Fakers.Applicants.Requests
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using ApplicationLayer.Services.AuthServices.Common;
|
||||
using Bogus;
|
||||
|
||||
namespace VisaApi.Fakers.Auth
|
||||
{
|
||||
namespace VisaApi.Fakers.Auth;
|
||||
|
||||
public sealed class AuthDataFaker : Faker<AuthData>
|
||||
{
|
||||
public AuthDataFaker()
|
||||
@@ -12,4 +12,3 @@ namespace VisaApi.Fakers.Auth
|
||||
RuleFor(a => a.Password, f => f.Internet.Password());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using ApplicationLayer.Services.AuthServices.Requests;
|
||||
using Bogus;
|
||||
|
||||
namespace VisaApi.Fakers.Auth
|
||||
{
|
||||
namespace VisaApi.Fakers.Auth;
|
||||
|
||||
public sealed class RegisterRequestFaker : Faker<RegisterRequest>
|
||||
{
|
||||
private static AuthDataFaker authDataFaker = new();
|
||||
@@ -12,4 +12,3 @@ namespace VisaApi.Fakers.Auth
|
||||
RuleFor(r => r.AuthData, () => authDataFaker.Generate());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using ApplicationLayer.Services.Users.Models;
|
||||
using Bogus;
|
||||
|
||||
namespace VisaApi.Fakers.Common
|
||||
{
|
||||
namespace VisaApi.Fakers.Common;
|
||||
|
||||
public sealed class ChangeAuthDataFaker : Faker<ChangeAuthData>
|
||||
{
|
||||
public ChangeAuthDataFaker()
|
||||
@@ -12,4 +12,3 @@ namespace VisaApi.Fakers.Common
|
||||
RuleFor(a => a.Password, f => f.Internet.Password());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using Bogus;
|
||||
using VisaApi.Fakers.Common;
|
||||
|
||||
namespace VisaApi.Fakers.Users.Requests
|
||||
{
|
||||
namespace VisaApi.Fakers.Users.Requests;
|
||||
|
||||
public sealed class ChangeUserAuthDataRequestFaker : Faker<ChangeUserAuthDataRequest>
|
||||
{
|
||||
private static ChangeAuthDataFaker changeAuthDataFaker = new();
|
||||
@@ -13,4 +13,3 @@ namespace VisaApi.Fakers.Users.Requests
|
||||
CustomInstantiator(_ => new(Guid.NewGuid(), changeAuthDataFaker.Generate()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Bogus;
|
||||
using Domains.Users;
|
||||
|
||||
namespace VisaApi.Fakers.Users
|
||||
{
|
||||
namespace VisaApi.Fakers.Users;
|
||||
|
||||
/// <summary>
|
||||
/// Generates users
|
||||
/// </summary>
|
||||
@@ -15,4 +15,3 @@ namespace VisaApi.Fakers.Users
|
||||
RuleFor(u => u.Password, f => f.Internet.Password());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using Bogus;
|
||||
using Domains.VisaApplicationDomain;
|
||||
|
||||
namespace VisaApi.Fakers.VisaApplications
|
||||
{
|
||||
namespace VisaApi.Fakers.VisaApplications;
|
||||
|
||||
/// <summary>
|
||||
/// Generates past visas
|
||||
/// </summary>
|
||||
@@ -26,4 +26,3 @@ namespace VisaApi.Fakers.VisaApplications
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using Bogus;
|
||||
using Domains.VisaApplicationDomain;
|
||||
|
||||
namespace VisaApi.Fakers.VisaApplications
|
||||
{
|
||||
namespace VisaApi.Fakers.VisaApplications;
|
||||
|
||||
/// <summary>
|
||||
/// Generates past visas
|
||||
/// </summary>
|
||||
@@ -26,4 +26,3 @@ namespace VisaApi.Fakers.VisaApplications
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using Bogus;
|
||||
using Domains.VisaApplicationDomain;
|
||||
|
||||
namespace VisaApi.Fakers.VisaApplications
|
||||
{
|
||||
namespace VisaApi.Fakers.VisaApplications;
|
||||
|
||||
/// <summary>
|
||||
/// Generates permissions to destination Country
|
||||
/// </summary>
|
||||
@@ -17,4 +17,3 @@ namespace VisaApi.Fakers.VisaApplications
|
||||
f => f.Date.Future(4, dateTimeProvider.Now()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ using Bogus;
|
||||
using Domains;
|
||||
using Domains.VisaApplicationDomain;
|
||||
|
||||
namespace VisaApi.Fakers.VisaApplications
|
||||
{
|
||||
namespace VisaApi.Fakers.VisaApplications;
|
||||
|
||||
/// <summary>
|
||||
/// Generates re-entry permissions
|
||||
/// </summary>
|
||||
@@ -19,4 +19,3 @@ namespace VisaApi.Fakers.VisaApplications
|
||||
f => f.Date.Future(4, dateTimeProvider.Now()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ using Domains;
|
||||
using Domains.ApplicantDomain;
|
||||
using Domains.VisaApplicationDomain;
|
||||
|
||||
namespace VisaApi.Fakers.VisaApplications
|
||||
{
|
||||
namespace VisaApi.Fakers.VisaApplications;
|
||||
|
||||
/// <summary>
|
||||
/// Generates visa applications
|
||||
/// </summary>
|
||||
@@ -62,4 +62,3 @@ namespace VisaApi.Fakers.VisaApplications
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using ApplicationLayer.InfrastructureServicesInterfaces;
|
||||
|
||||
namespace VisaApi.Services
|
||||
{
|
||||
namespace VisaApi.Services;
|
||||
|
||||
public class TestDateTimeProvider : IDateTimeProvider
|
||||
{
|
||||
public DateTime Now() => DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@ using FluentValidation;
|
||||
using VisaApi.Fakers.Applicants.Requests;
|
||||
using Xunit;
|
||||
|
||||
namespace VisaApi.Tests.Application.Validation.Applicants
|
||||
{
|
||||
namespace VisaApi.Tests.Application.Validation.Applicants;
|
||||
|
||||
public class NameModelValidatorTests
|
||||
{
|
||||
private static IValidator<NameModel> validator = new NameModelValidator();
|
||||
private static NameModelFaker faker = new();
|
||||
private readonly static IValidator<NameModel> validator = new NameModelValidator();
|
||||
private readonly static NameModelFaker faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Test for <see cref="NameModel"/> validator that should throw for empty first name
|
||||
@@ -168,4 +168,3 @@ namespace VisaApi.Tests.Application.Validation.Applicants
|
||||
result.Errors.Should().BeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@ using VisaApi.Fakers.Applicants.Requests;
|
||||
using VisaApi.Services;
|
||||
using Xunit;
|
||||
|
||||
namespace VisaApi.Tests.Application.Validation.Applicants
|
||||
{
|
||||
namespace VisaApi.Tests.Application.Validation.Applicants;
|
||||
|
||||
public class PassportModelValidatorTests
|
||||
{
|
||||
private static IDateTimeProvider dateTimeProvider = new TestDateTimeProvider();
|
||||
private static IValidator<PassportModel> validator = new PassportModelValidator(dateTimeProvider);
|
||||
private static PassportModelFaker faker = new(dateTimeProvider);
|
||||
private readonly static IDateTimeProvider dateTimeProvider = new TestDateTimeProvider();
|
||||
private readonly static IValidator<PassportModel> validator = new PassportModelValidator(dateTimeProvider);
|
||||
private readonly static PassportModelFaker faker = new(dateTimeProvider);
|
||||
|
||||
/// <summary>
|
||||
/// Test for <see cref="PassportModel"/> validator that should return error for empty number
|
||||
@@ -172,4 +172,3 @@ namespace VisaApi.Tests.Application.Validation.Applicants
|
||||
result.Errors.Should().BeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@ using FluentValidation;
|
||||
using VisaApi.Fakers.Applicants.Requests;
|
||||
using Xunit;
|
||||
|
||||
namespace VisaApi.Tests.Application.Validation.Applicants
|
||||
{
|
||||
namespace VisaApi.Tests.Application.Validation.Applicants;
|
||||
|
||||
public class PlaceOfWorkModelValidatorTests
|
||||
{
|
||||
private static IValidator<PlaceOfWorkModel> validator = new PlaceOfWorkModelValidator();
|
||||
private static PlaceOfWorkModelFaker faker = new();
|
||||
private readonly static IValidator<PlaceOfWorkModel> validator = new PlaceOfWorkModelValidator();
|
||||
private readonly static PlaceOfWorkModelFaker faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Test for <see cref="PlaceOfWorkModel"/> validator that should return error for empty phone num
|
||||
@@ -351,4 +351,3 @@ namespace VisaApi.Tests.Application.Validation.Applicants
|
||||
result.Errors.Should().BeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ using FluentValidation;
|
||||
using VisaApi.Fakers.Auth;
|
||||
using Xunit;
|
||||
|
||||
namespace VisaApi.Tests.Application.Validation.Auth
|
||||
{
|
||||
namespace VisaApi.Tests.Application.Validation.Auth;
|
||||
|
||||
public class AuthDataValidatorTests
|
||||
{
|
||||
private readonly static IValidator<AuthData> validator = new AuthDataValidator();
|
||||
@@ -111,4 +111,3 @@ namespace VisaApi.Tests.Application.Validation.Auth
|
||||
.Should().BeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ using VisaApi.Fakers.Users;
|
||||
using VisaApi.Tests.Infrastructure.Database;
|
||||
using Xunit;
|
||||
|
||||
namespace VisaApi.Tests.Application.Validation.Auth
|
||||
{
|
||||
namespace VisaApi.Tests.Application.Validation.Auth;
|
||||
|
||||
[Collection(Collections.ContextUsingTestCollection)]
|
||||
public class RegisterRequestValidatorTests
|
||||
{
|
||||
@@ -91,4 +91,3 @@ namespace VisaApi.Tests.Application.Validation.Auth
|
||||
result.Errors.Should().BeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ using FluentValidation;
|
||||
using VisaApi.Fakers.Users.Requests;
|
||||
using Xunit;
|
||||
|
||||
namespace VisaApi.Tests.Application.Validation.Users
|
||||
{
|
||||
namespace VisaApi.Tests.Application.Validation.Users;
|
||||
|
||||
public class ChangeUserAuthDataRequestValidationTests
|
||||
{
|
||||
private readonly static IValidator<ChangeUserAuthDataRequest> validator = new ChangeUserAuthDataRequestValidator();
|
||||
@@ -46,4 +46,3 @@ namespace VisaApi.Tests.Application.Validation.Users
|
||||
result.IsValid.Should().BeTrue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
using DbContext = Infrastructure.Database.DbContext;
|
||||
|
||||
namespace VisaApi.Tests.Infrastructure.Database
|
||||
{
|
||||
namespace VisaApi.Tests.Infrastructure.Database;
|
||||
|
||||
public static class InMemoryContextProvider
|
||||
{
|
||||
private static DbContextOptions<DbContext> opts = new DbContextOptionsBuilder<DbContext>()
|
||||
@@ -21,4 +21,3 @@ namespace VisaApi.Tests.Infrastructure.Database
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ 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
|
||||
{
|
||||
@@ -152,4 +152,3 @@ 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
|
||||
{
|
||||
namespace VisaApi.Tests.Infrastructure.Database.Repositories.Generic;
|
||||
|
||||
public class TestGenericRepository(IGenericReader reader, IGenericWriter writer) : GenericRepository<User>(reader, writer);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ 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
|
||||
{
|
||||
@@ -89,4 +89,3 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories
|
||||
result.Should().Contain(users).And.HaveSameCount(users);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ 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
|
||||
{
|
||||
@@ -263,4 +263,3 @@ namespace VisaApi.Tests.Infrastructure.Database.Repositories
|
||||
result.Should().Contain(applicationPending).And.HaveCount(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user