public void YammerMessagePoster_PostReply_ShouldSucceed()
        {
            var testBody = "This is a body";
            var serviceResponseText = @"Testing";
            var testMessage = new Message();
            var deserializedResponse = new MessagesFetchResponse
            {
                Messages = new List<Message>
                                                              {
                                                                  testMessage
                                                              }
            };

            _serviceManager.Setup(s => s.PostMessageReply(It.IsAny<string>(), It.IsAny<long>())).Returns(serviceResponseText);
            _deserializer.Setup(s => s.DeserializeMessagesResponse(It.IsAny<string>())).Returns(deserializedResponse);

            var result = _messagePoster.PostReply(testBody, 1);

            Assert.AreEqual(testMessage, result);
            _serviceManager.Verify(v => v.PostMessageReply(It.Is<string>(i => i == testBody), It.Is<long>(i=>i==1)), Times.Once());
            _deserializer.Verify(v => v.DeserializeMessagesResponse(It.Is<string>(i => i == serviceResponseText)), Times.Once());
        }
Esempio n. 2
0
 public void AddMessage(Message message)
 {
     _context.Messages.Add(message);
 }