コード例 #1
0
        public void GetMessage_WithId_ReturnsSentMessage()
        {
            // Arrange
            Guid id = Guid.NewGuid();

            RestResource resource = new MessageHeadersResource(id);

            RestResponse response = new RestResponse()
            {
                StatusCode = HttpStatusCode.OK,
                Content    = "serialisedItem"
            };

            InboxMessage expectedResult = new InboxMessage();

            mockRestClient
            .Setup(rc => rc.Get(resource))
            .Returns(response);

            mockSerialiser
            .Setup(s => s.Deserialise <InboxMessage>(response.Content))
            .Returns(expectedResult);

            // Act
            InboxMessage actualResult = service.GetMessage(id);

            // Assert
            Assert.AreEqual(expectedResult, actualResult);
        }