public void When_account_holder_moved_command_is_triggered_but_nothing_has_changed_it_should_throw() { // Arrange var account = new Account(Guid.NewGuid(), "Thomas"); account.SetDetails("Thomas", "New Address", "New Town"); var eventStore = new InMemoryEventRepositoryBuilder().WithAggregates(account).Build(); var handler = new AccountHolderMovedCommandHandler(eventStore); // Act Action action = () => handler.Handle(new AccountHolderMovedCommand(account.Id, "New Address", "New Town")); // Assert action.ShouldThrow<InvalidOperationException>(); }
public void When_set_account_details_command_is_triggered_but_nothing_has_changed_it_should_not_raise_events() { // Arrange var account = new Account(Guid.NewGuid(), "Thomas"); account.SetDetails("New Name", "New Address", "New Town"); var eventStore = new InMemoryEventRepositoryBuilder().WithAggregates(account).Build(); var handler = new SetAccountDetailsCommandHandler(eventStore); // Act handler.Handle(new SetAccountDetailsCommand(account.Id, "New Name", "New Address", "New Town")); // Assert eventStore.Events.Should().BeEmpty(); }