public void GetMessage_WithId_ReturnsSentMessage()
        {
            // Arrange
            var id = Guid.NewGuid();

            RestResource resource = new MessageHeadersResource(id);

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

            var expectedResult = new SentMessage();

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

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

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

            // Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Determines whether the specified System.Object are considered equal.
        /// </summary>
        /// <param name="obj">The System.Object to compare with the current System.Object</param>
        /// <returns>true if the specified System.Object is equal to the current System.Object; otherwise, false.</returns>
        public override bool Equals(object obj)
        {
            SentMessage other = obj as SentMessage;

            if (other == null)
            {
                return(false);
            }

            if (SubmittedAt != other.SubmittedAt)
            {
                return(false);
            }
            if (SentAt != other.SentAt)
            {
                return(false);
            }
            if (DeliveredAt != other.DeliveredAt)
            {
                return(false);
            }

            return(base.Equals(obj));
        }