public SendGridValueBinderTests()
        {
            Web web = new Web("1234");

            _message     = new SendGridMessage();
            _valueBinder = new SendGridValueBinder(web, _message);
        }
        public async Task SetValueAsync_InvalidMessage_Throws()
        {
            Web web = new Web("1234");
            SendGridMessage message = new SendGridMessage
            {
                From = new System.Net.Mail.MailAddress("*****@*****.**")
            };
            message.AddTo("*****@*****.**");

            SendGridValueBinder binder = new SendGridValueBinder(web, message);

            // SendGrid isn't mockable, so we're just catching their exception as proof
            // that we called send
            await Assert.ThrowsAsync<Exceptions.InvalidApiRequestException>(
                async () => { await binder.SetValueAsync(message, CancellationToken.None); });
        }
        public async Task SetValueAsync_InvalidMessage_Throws()
        {
            Web             web     = new Web("1234");
            SendGridMessage message = new SendGridMessage
            {
                From = new System.Net.Mail.MailAddress("*****@*****.**")
            };

            message.AddTo("*****@*****.**");

            SendGridValueBinder binder = new SendGridValueBinder(web, message);

            // SendGrid isn't mockable, so we're just catching their exception as proof
            // that we called send
            await Assert.ThrowsAsync <Exceptions.InvalidApiRequestException>(
                async() => { await binder.SetValueAsync(message, CancellationToken.None); });
        }
 public SendGridValueBinderTests()
 {
     Web web = new Web("1234");
     _message = new SendGridMessage();
     _valueBinder = new SendGridValueBinder(web, _message);
 }