public void GivenAReadCommandWhenExecuteMethodIsCalledThenItCallsReadInTheCommandReceiver() { var command = new ReadCommand(this.receiver, BobUserHandle); command.Execute(); this.receiver.Received().Read(BobUserHandle); }
public void GivenAReadCommandWhenCreateFormaterForCommandIsInvokedOnFactoryThenItReturnsAMessageFromater() { var command = new ReadCommand(this.brokerMock, BobUserHandle); var factory = new MessageFormaterFactory(); var formater = factory.CreateFormaterForCommand(command); formater.Should().BeAssignableTo<MessageFormater>(); }
public void GivenAReadCommandWhenExecuteMethodIsCalledThenItStoresTheExecutionResultInResults() { var command = new ReadCommand(this.receiver, BobUserHandle); this.receiver.Read(BobUserHandle).Returns(new[] { new Message(null, PostMessageText) }); command.Execute(); ((IQueryCommand)command).Results.Should().Contain(m => m.Body == PostMessageText); }