Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }