public void PublishMessage_WithParameter_ExecuteQuery() { // Arrange var controller = CreateMessageController(); var parameter = new PublishMessageParameters(TestHelper.GenerateString(), TestHelper.GenerateRandomInt()); // Act controller.PublishMessage(parameter); // Assert _fakeMessageQueryExecutor.CallsTo(x => x.PublishMessage(parameter)).MustHaveHappened(); }
public void PublishMessage_WithMessageDTO_ExecuteQuery() { // Arrange var controller = CreateMessageController(); var message = A.Fake<IMessageDTO>(); message.CallsTo(x => x.Recipient).Returns(A.Fake<IUserDTO>()); message.CallsTo(x => x.Text).Returns(TestHelper.GenerateString()); var parameter = new PublishMessageParameters(message); // Act controller.PublishMessage(parameter); // Assert _fakeMessageQueryExecutor .CallsTo(x => x.PublishMessage(A<IPublishMessageParameters>.That.Matches(p => p.Message == message))) .MustHaveHappened(); }