-
-
Save explorer14/46589f9b3f22b4200f5b7230afa045a0 to your computer and use it in GitHub Desktop.
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
[Fact] | |
public async Task ShouldRegisterCustomerIfNotAlreadyRegistered() | |
{ | |
var customerRepositoryStub = CreateEmptyRepository(); | |
var testCustomerRegistrationRequest = new CustomerRegistrationRequest( | |
email: "customer@gmail.com", | |
dateOfBirth: new DateTime(1975, 2, 21), | |
firstName: "Joe", | |
lastName: "Bloggs"); | |
// Create the system under test with a stub and a dummy | |
var useCase = new CustomerRegistrationUseCase( | |
customerRepositoryStub, | |
new Mock<IEventBus>().Object); | |
await useCase.RegisterCustomer(testCustomerRegistrationRequest); | |
var registeredCustomer = await customerRepositoryStub.GetByEmail( | |
testCustomerRegistrationRequest.Email); | |
registeredCustomer.Should().NotBeNull(); | |
registeredCustomer.DateOfBirth.Should().Be(testCustomerRegistrationRequest.DateOfBirth); | |
registeredCustomer.FirstName.Should().Be(testCustomerRegistrationRequest.FirstName); | |
registeredCustomer.LastName.Should().Be(testCustomerRegistrationRequest.LastName); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment