-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from HammerheadShark666/run-vs-code-cleanup
Run vs code cleanup
- Loading branch information
Showing
22 changed files
with
72 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
using Microservice.Customer.Api.Data.Repository.Interfaces; | ||
using Microservice.Customer.Api.Helpers; | ||
using Microservice.Customer.Api.Helpers.Interfaces; | ||
using Microservice.Customer.Api.MediatR.AddCustomer; | ||
using Microservice.Customer.Api.Mediatr.UpdateCustomer; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
using Moq; | ||
|
@@ -18,7 +18,6 @@ public class UpdateCustomerMediatrTests | |
{ | ||
private readonly Mock<ICustomerRepository> customerRepositoryMock = new(); | ||
private readonly Mock<ICustomerHttpAccessor> customerHttpAccessorMock = new(); | ||
private readonly Mock<ILogger<UpdateCustomerCommandHandler>> loggerMock = new(); | ||
private readonly ServiceCollection services = new(); | ||
private ServiceProvider serviceProvider; | ||
private IMediator mediator; | ||
|
@@ -160,13 +159,16 @@ public void Customer_not_updated_invalid_surname_first_name_return_exception_fai | |
await mediator.Send(updateCustomerRequest); | ||
}); | ||
|
||
Assert.That(validationException.Errors.Count, Is.EqualTo(2)); | ||
Assert.That(validationException.Errors.ElementAt(0).ErrorMessage, Is.EqualTo("Surname length between 1 and 30.")); | ||
Assert.That(validationException.Errors.ElementAt(1).ErrorMessage, Is.EqualTo("First name length between 1 and 30.")); | ||
Assert.Multiple(() => | ||
{ | ||
Assert.That(validationException.Errors.Count, Is.EqualTo(2)); | ||
Assert.That(validationException.Errors.ElementAt(0).ErrorMessage, Is.EqualTo("Surname length between 1 and 30.")); | ||
Assert.That(validationException.Errors.ElementAt(1).ErrorMessage, Is.EqualTo("First name length between 1 and 30.")); | ||
}); | ||
} | ||
|
||
[Test] | ||
public void Customer_not_updated_no_email_surname_firstname_return_exception_fail_message() | ||
public void Customer_not_updated_no_email_surname_first_name_return_exception_fail_message() | ||
{ | ||
customerRepositoryMock | ||
.Setup(x => x.ExistsAsync("[email protected]")) | ||
|
@@ -179,13 +181,16 @@ public void Customer_not_updated_no_email_surname_firstname_return_exception_fai | |
await mediator.Send(updateCustomerRequest); | ||
}); | ||
|
||
Assert.That(validationException.Errors.Count, Is.EqualTo(7)); | ||
Assert.That(validationException.Errors.ElementAt(0).ErrorMessage, Is.EqualTo("Email is required.")); | ||
Assert.That(validationException.Errors.ElementAt(1).ErrorMessage, Is.EqualTo("Email length between 8 and 150.")); | ||
Assert.That(validationException.Errors.ElementAt(2).ErrorMessage, Is.EqualTo("Invalid Email.")); | ||
Assert.That(validationException.Errors.ElementAt(3).ErrorMessage, Is.EqualTo("Surname is required.")); | ||
Assert.That(validationException.Errors.ElementAt(4).ErrorMessage, Is.EqualTo("Surname length between 1 and 30.")); | ||
Assert.That(validationException.Errors.ElementAt(5).ErrorMessage, Is.EqualTo("First name is required.")); | ||
Assert.That(validationException.Errors.ElementAt(6).ErrorMessage, Is.EqualTo("First name length between 1 and 30.")); | ||
Assert.Multiple(() => | ||
{ | ||
Assert.That(validationException.Errors.Count, Is.EqualTo(7)); | ||
Assert.That(validationException.Errors.ElementAt(0).ErrorMessage, Is.EqualTo("Email is required.")); | ||
Assert.That(validationException.Errors.ElementAt(1).ErrorMessage, Is.EqualTo("Email length between 8 and 150.")); | ||
Assert.That(validationException.Errors.ElementAt(2).ErrorMessage, Is.EqualTo("Invalid Email.")); | ||
Assert.That(validationException.Errors.ElementAt(3).ErrorMessage, Is.EqualTo("Surname is required.")); | ||
Assert.That(validationException.Errors.ElementAt(4).ErrorMessage, Is.EqualTo("Surname length between 1 and 30.")); | ||
Assert.That(validationException.Errors.ElementAt(5).ErrorMessage, Is.EqualTo("First name is required.")); | ||
Assert.That(validationException.Errors.ElementAt(6).ErrorMessage, Is.EqualTo("First name length between 1 and 30.")); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,11 @@ public class DefaultData | |
{ | ||
public static List<Domain.Customer> GetCustomerDefaultData() | ||
{ | ||
return new List<Domain.Customer>() | ||
{ | ||
return | ||
[ | ||
CreateCustomer(new Guid("6c84d0a3-0c0c-435f-9ae0-4de09247ee15"), "Intergration_Test", "Intergration_Test", "[email protected]"), | ||
CreateCustomer(new Guid("929eaf82-e4fd-4efe-9cae-ce4d7e32d159"), "Intergration_Test2", "Intergration_Test2", "[email protected]") | ||
}; | ||
]; | ||
} | ||
|
||
private static Domain.Customer CreateCustomer(Guid id, string surname, string firstName, string email) | ||
|
2 changes: 1 addition & 1 deletion
2
Microservice.Customer.Api/Data/Repository/CustomerRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
Microservice.Customer.Api/Extensions/IServiceCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
Microservice.Customer.Api/Mediatr/UpdateCustomer/UpdateCustomerMapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Microservice.Customer.Api/Mediatr/UpdateCustomer/UpdateCustomerRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
using MediatR; | ||
|
||
namespace Microservice.Customer.Api.MediatR.AddCustomer; | ||
namespace Microservice.Customer.Api.Mediatr.UpdateCustomer; | ||
|
||
public record UpdateCustomerRequest(Guid Id, string Email, string Surname, string FirstName) : IRequest<UpdateCustomerResponse>; |
2 changes: 1 addition & 1 deletion
2
Microservice.Customer.Api/Mediatr/UpdateCustomer/UpdateCustomerResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
namespace Microservice.Customer.Api.MediatR.AddCustomer; | ||
namespace Microservice.Customer.Api.Mediatr.UpdateCustomer; | ||
|
||
public record UpdateCustomerResponse(string message); |
2 changes: 1 addition & 1 deletion
2
Microservice.Customer.Api/Mediatr/UpdateCustomer/UpdateCustomerValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Microservice.Customer.Api/Migrations/20240727104340_create-table-default-data.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
Microservice.Customer.Api/Migrations/CustomerDbContextModelSnapshot.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.