public void ShouldDispatchCommitNumberCommand() { var command = new CommitNumberCommand(Enums.CalculatorOperation.Addition, 17); commandDispatcher.Dispatch(command); // The test command handler will indicate if it received a command. Assert.IsTrue(numberCommandHandler.IsHandled); Assert.AreSame(command, numberCommandHandler.Command); }
public void ShouldHaveCommitNumberEventMatchingCommandNumber() { var command = new CommitNumberCommand(CalculatorOperation.Multiplication, 23); commandHandler.Execute(command); // Find the event in the event store. var numberResult = eventStore.Events.ElementAt(1); Assert.IsInstanceOfType(numberResult, typeof(CommitNumberEvent)); Assert.AreEqual(23, (numberResult as CommitNumberEvent).Number); }
public void ShouldCreateASetOperationEvent() { var command = new CommitNumberCommand(CalculatorOperation.Addition, 7); commandHandler.Execute(command); // Find the event in the event store. var result = eventStore.Events.FirstOrDefault(); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(SetOperationEvent)); }
public void ShouldHaveOperationEventMatchingCommandOperation() { var command = new CommitNumberCommand(CalculatorOperation.Subtraction, 17); commandHandler.Execute(command); // Find the event in the event store. var result = eventStore.Events.FirstOrDefault(); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(SetOperationEvent)); Assert.AreEqual(CalculatorOperation.Subtraction, (result as SetOperationEvent).Operation); }
public void ShouldCreateACommitNumberEventAfterSetOperation() { var command = new CommitNumberCommand(CalculatorOperation.Addition, 7); commandHandler.Execute(command); // Find the event in the event store. var operationResult = eventStore.Events.ElementAt(0); var numberResult = eventStore.Events.ElementAt(1); Assert.IsInstanceOfType(operationResult, typeof(SetOperationEvent)); Assert.IsInstanceOfType(numberResult, typeof(CommitNumberEvent)); }