Microsoft.Protocols.TestSuites.MS_ASAIRS.S02_BodyPreference.VerifyBodyPreview C# (CSharp) Method

VerifyBodyPreview() private method

Verify the Preview element in Body element.
private VerifyBodyPreview ( Microsoft.Protocols.TestSuites.Common.DataStructures email, Microsoft.Protocols.TestSuites.Common.DataStructures allContentEmail, Request bodyPreference ) : void
email Microsoft.Protocols.TestSuites.Common.DataStructures The email item got from server.
allContentEmail Microsoft.Protocols.TestSuites.Common.DataStructures The email item which has full content.
bodyPreference Microsoft.Protocols.TestSuites.Common.Request A BodyPreference object.
return void
        private void VerifyBodyPreview(DataStructures.Email email, DataStructures.Email allContentEmail, Request.BodyPreference[] bodyPreference)
        {
            Site.Assert.IsNotNull(
                email.Body,
                "The Body element should be included in command response when the BodyPreference element is specified in command request.");

            Site.Assert.IsNotNull(
                email.Body.Preview,
                "The Preview element should be included in command response when the Preview element is specified in command request.");

            Site.Assert.IsTrue(
                email.Body.Preview.Length <= bodyPreference[0].Preview,
                "The Preview element in a response should contain no more than the number of characters specified in the request. The length of Preview element in response is: {0}.",
                email.Body.Preview.Length);

            Site.Assert.IsTrue(
                allContentEmail.Body.Data.Contains(email.Body.Preview),
                "The Preview element in a response should contain the message part preview returned to the client.");
        }