private IEnvelope CreateTestEmailMessage(string To)
        {
            var content = new PickAvailableMessage
            {
                HtmlBody         = "<!DOCTYPE html><html><body>Hello world!<p>The intention of this email to understand what it will take to get email that is not considered spam coming from SendGrid. The journey has been extremely educational for me and I dare say enjoyable.</body></html> ",
                PlainTextBody    = "Hello world!\r\nThe intention of this email to understand what it will take to get email that is not considered spam coming from SendGrid. The process or I should journey has been extremely educational for me and I dare say enjoyable.",
                Name             = "C",
                NotificationType = NotifyType.Email,
                Subject          = "Test Message",
                ToAddress        = To
            };

            return(new Envelope(content));
        }
        public void MessageEnvelopeSerializeDeserialize()
        {
            // Arrange
            var envelopeContent = new PickAvailableMessage();

            envelopeContent.NotificationType = NotifyType.Email;
            var sut = new Envelope(envelopeContent);

            // Act
            var serialized = JsonConvert.SerializeObject(sut);

            var envelope = JsonConvert.DeserializeObject <Envelope>(serialized);
            var actual   = JsonConvert.DeserializeObject <PickAvailableMessage>(envelope.Payload);

            // Assert
            Assert.Equal <string>(envelopeContent.NotificationType, actual.NotificationType);
        }
        public void GivenAMessageWhenSerializedThenItDeserilzes()
        {
            // Arrange
            var sut = new PickAvailableMessage
            {
                HtmlBody         = "<html><body>Hello World!</body></html>",
                PlainTextBody    = "HelloWorld",
                Name             = "bill",
                Subject          = "test email subject",
                ToAddress        = "*****@*****.**",
                NotificationType = NotifyType.Email
            };
            var sutAsString = JsonConvert.SerializeObject(sut);
            // Act
            var actual = JsonConvert.DeserializeObject <PickAvailableMessage>(sutAsString);

            // Assert
            Assert.Equal <string>(sut.HtmlBody, actual.HtmlBody);
            Assert.Equal <string>(sut.PlainTextBody, actual.PlainTextBody);
            Assert.Equal <string>(sut.Name, actual.Name);
            Assert.Equal <string>(sut.Subject, actual.Subject);
            Assert.Equal <string>(sut.ToAddress, actual.ToAddress);
            Assert.Equal <string>(sut.NotificationType, actual.NotificationType);
        }