Skip to content

Instantly share code, notes, and snippets.

Last active Jun 8, 2020
What would you like to do?
public async Task ShouldPublishNotificationForSuccessfulRegistration()
var customerRepositoryStub = CreateEmptyRepository();
// Notice, I don't really care about the values in the request
// because I am testing the collaboration with the event bus
var testCustomerRegistrationRequest = CreateTestRequest();
var eventBusMock = new Mock<IEventBus>();
// Create the system under test with a stub and a mock
var useCase = new CustomerRegistrationUseCase(
await useCase.RegisterCustomer(testCustomerRegistrationRequest);
eventBusMock.Verify(x=>x.Publish(It.IsAny<NewCustomerRegistered>()), Times.Once);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment