/// <summary>
        /// Load and append the text to the given MessageBody
        /// </summary>
        /// <param name="messageBody"></param>
        public void LoadBodyText(MessageBody messageBody)
        {
            var resource = new ResourceLinkResource(messageBody);

            var response = MakeRequest<MessageBody>(HttpMethod.GET, resource);

            messageBody.BodyText = response.BodyText;
        }
        /// <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)
        {
            MessageBody other = obj as MessageBody;

            if (other == null)
            {
                return(false);
            }
            if (BodyText != other.BodyText)
            {
                return(false);
            }

            return(base.Equals(obj));
        }
        public void LoadBodyText_UpdatesMessageBodyWithBodyText()
        {
            const string expectedMessageBody = "This is the body of the message";

            var id = Guid.NewGuid();
            var messageBody = new MessageBody
            {
                Id = id,
                Uri = string.Format("https://api.esendex.com/v1.0/messageheaders/{0}/body", id),
                BodyText = string.Empty
            };

            mockRestClient
                .Setup(c => c.Get(It.IsAny<ResourceLinkResource>()))
                .Returns(new RestResponse());
            mockSerialiser
                .Setup(s => s.Deserialise<MessageBody>(It.IsAny<string>()))
                .Returns(new MessageBody {BodyText = expectedMessageBody});

            service.LoadBodyText(messageBody);

            Assert.That(messageBody.BodyText, Is.EqualTo(expectedMessageBody));
        }
示例#4
0
 /// <summary>
 /// Initialises a new instance of the com.esendex.sdk.core.Message
 /// </summary>
 public Message()
 {
     Body       = new MessageBody();
     Recipient  = new MessageContact();
     Originator = new MessageContact();
 }
示例#5
0
 /// <summary>
 /// Initialises a new instance of the com.esendex.sdk.core.Message
 /// </summary>
 public Message()
 {
     Body = new MessageBody();
     Recipient = new MessageContact();
     Originator = new MessageContact();
 }