public void ValidateIMessageBase_ReturnsMessageValidationEmptySubject_WhenSubjectIsEmpty() { //Arrange var message = new BasicMessage { Subject = string.Empty }; var validator = new SendValidator(); //Act var actual = validator.ValidateIMessageBase(message); //Assert Assert.AreEqual(SendResult.MessageValidationEmptySubject, actual); }
public void ValidateIMessageBase_ReturnsMessageValidationEmptyMessage_WhenSubjectAndFromRecipientAndAllBodyFieldsAreEmpty() { //Arrange var message = new BasicMessage { Subject = RandomHelper.RandomString(), From = new EmailAddress(RandomHelper.RandomEmail()) }; var validator = new SendValidator(); //Act var actual = validator.ValidateIMessageBase(message); //Assert Assert.AreEqual(SendResult.MessageValidationEmptyMessage, actual); }
public void ValidateIMessageBase_ReturnsEmailAddressValidationInvalidFrom_WhenFromRecipientIsInvalid() { //Arrange var message = new BasicMessage { Subject = RandomHelper.RandomString(), From = new EmailAddress("$$##%%") }; var validator = new SendValidator(); //Act var actual = validator.ValidateIMessageBase(message); //Assert Assert.AreEqual(SendResult.EmailAddressValidationInvalidFrom, actual); }
public void ValidateIMessageBase_ReturnsSuccess_WhenSubjectAndFromRecipientAndApiTemplateIsNotEmpty() { //Arrange var message = new BasicMessage { Subject = RandomHelper.RandomString(), From = new EmailAddress(RandomHelper.RandomEmail()), ApiTemplate = RandomHelper.RandomInt() }; var validator = new SendValidator(); //Act var actual = validator.ValidateIMessageBase(message); //Assert Assert.AreEqual(SendResult.Success, actual); }
public void ValidateIMessageBase_ReturnsMessageValidationInvalidCustomHeaders_WhenCustomHeadersAreInvalid() { //Arrange var message = new BasicMessage { Subject = RandomHelper.RandomString(), From = new EmailAddress(RandomHelper.RandomEmail()), HtmlBody = RandomHelper.RandomString(), CustomHeaders = new List <ICustomHeader>() { new CustomHeader(string.Empty, string.Empty) } }; var validator = new SendValidator(); //Act var actual = validator.ValidateIMessageBase(message); //Assert Assert.AreEqual(SendResult.MessageValidationInvalidCustomHeaders, actual); }