Skip to content

Instantly share code, notes, and snippets.

@explorer14
Created June 8, 2020 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save explorer14/329e356fd031a713f5247596aa8babcf to your computer and use it in GitHub Desktop.
Save explorer14/329e356fd031a713f5247596aa8babcf to your computer and use it in GitHub Desktop.
[Fact]
public async Task ShouldThrowIfCustomerAlreadyRegistered()
{
var email = "customer@gmail.com";
var customerRepositoryStub = CreateRepositoryWith(TestCustomerWith(email));
var testCustomerRegistrationRequest = new CustomerRegistrationRequest(
email,
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 Assert.ThrowsAsync<CustomerAlreadyExists>(()=>
useCase.RegisterCustomer(testCustomerRegistrationRequest));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment