public void FilterSubFilterTest()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterSubFilterTest Subject", "FilterSubFilterTest Body");

            TestObject.On       = FilterKeyEnum.From;
            TestObject.Operator = FilterOperatorEnum.Equals;
            TestObject.Value    = "*****@*****.**";

            Filter toFilter = new Filter();

            toFilter.On       = FilterKeyEnum.To;
            toFilter.Operator = FilterOperatorEnum.Equals;
            toFilter.Value    = "*****@*****.**";

            Filter subjectFilter = new Filter();

            subjectFilter.On       = FilterKeyEnum.Subject;
            subjectFilter.Operator = FilterOperatorEnum.Equals;
            subjectFilter.Value    = "FilterSubFilterTest Subject";

            TestObject.Filters.Add(toFilter);
            toFilter.Filters.Add(subjectFilter);

            PrepareLogger();

            Assert.IsTrue(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
        public void FilterSubFilterTestFailed()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterSubFilterTestFailed Subject", "FilterSubFilterTestFailed Body");

            TestObject.On       = FilterKeyEnum.From;
            TestObject.Operator = FilterOperatorEnum.Equals;
            TestObject.Value    = "*****@*****.**";

            var toFilter = new Filter
            {
                On       = FilterKeyEnum.To,
                Operator = FilterOperatorEnum.Equals,
                Value    = "*****@*****.**"
            };

            var subjectFilter = new Filter
            {
                On       = FilterKeyEnum.Subject,
                Operator = FilterOperatorEnum.Equals,
                Value    = "This can't be true!!!"
            };

            TestObject.Filters.Add(toFilter);
            toFilter.Filters.Add(subjectFilter);

            PrepareLogger();

            Assert.IsFalse(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
예제 #3
0
        public void AppliesToTest()
        {
            var emailMessage = EmailMessageHelper.CreateHtmlEmailMessage("NoopHandlerAppliesToTest Subject",
                                                                         "NoopHandlerAppliesToTest Body");

            PrepareLogger();
            Assert.IsTrue(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
        public void FilterLastExitCodeTestFailed()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterLastExitCodeTestFailed Subject", "FilterLastExitCodeTestFailed Body");

            TestObject.On       = FilterKeyEnum.LastExitCode;
            TestObject.Operator = FilterOperatorEnum.Equals;
            TestObject.Value    = "-1";

            PrepareLogger();

            Assert.IsFalse(TestObject.AppliesTo(new EmailItem(emailMessage), -2));
        }
        public void FilterFromContainsTestFailed()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterFromContainsTestFailed Subject", "FilterFromContainsTestFailed Body");

            TestObject.On       = FilterKeyEnum.From;
            TestObject.Operator = FilterOperatorEnum.Contains;
            TestObject.Value    = "is@neos";

            PrepareLogger();

            Assert.IsFalse(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
        public void FilterToEqualsTestFailed()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterToEqualsTestFailed Subject", "FilterToEqualsTestFailed Body");

            TestObject.On       = FilterKeyEnum.To;
            TestObject.Operator = FilterOperatorEnum.Equals;
            TestObject.Value    = "*****@*****.**";

            PrepareLogger();

            Assert.IsFalse(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
        public void FilterSubjectEqualsTest()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterSubjectEqualsTest Subject", "FilterSubjectEqualsTest Body");

            TestObject.On       = FilterKeyEnum.Subject;
            TestObject.Operator = FilterOperatorEnum.Equals;
            TestObject.Value    = "FilterSubjectEqualsTest Subject";

            PrepareLogger();

            Assert.IsTrue(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
        public void FilterSubjectEqualsTestFailed()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterSubjectEqualsTestFailed Subject", "FilterSubjectEqualsTestFailed Body");

            TestObject.On       = FilterKeyEnum.Subject;
            TestObject.Operator = FilterOperatorEnum.Equals;
            TestObject.Value    = "This can't be true!!!";

            PrepareLogger();

            Assert.IsFalse(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
        public void FilterFromStartsWithTest()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterFromStartsWithTest Subject", "FilterFromStartsWithTest Body");

            TestObject.On       = FilterKeyEnum.From;
            TestObject.Operator = FilterOperatorEnum.StartsWith;
            TestObject.Value    = "alice";

            PrepareLogger();

            Assert.IsTrue(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
        public void FilterFromRegexTestFailed()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterFromRegexTest Subject", "FilterFromRegexTest Body");

            TestObject.On       = FilterKeyEnum.From;
            TestObject.Operator = FilterOperatorEnum.Regex;
            TestObject.Value    = @"\w+@\w+.\w+";

            PrepareLogger();

            // Doesn't match due to missing '-' in neos-it...

            Assert.IsTrue(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
        public void FilterFromRegexTest()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterFromRegexTest Subject", "FilterFromRegexTest Body");

            TestObject.On       = FilterKeyEnum.From;
            TestObject.Operator = FilterOperatorEnum.Regex;
            TestObject.Value    = @"\w+@[\w\-]+.\w+";

            PrepareLogger();

            // Should match...

            Assert.IsTrue(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
        public void FilterFromEndsWithTest()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterFromEndsWithTest Subject", "FilterFromEndsWithTest Body");

            Filter fromFilter = new Filter();

            fromFilter.On       = FilterKeyEnum.From;
            fromFilter.Operator = FilterOperatorEnum.EndsWith;
            fromFilter.Value    = "*****@*****.**";

            TestObject.Filters.Add(fromFilter);
            PrepareLogger();

            Assert.IsTrue(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
        public void FilterFromEqualsTestFailed()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterFromEqualsTestFailed Subject", "FilterFromEqualsTestFailed Body");

            Filter fromFilter = new Filter();

            fromFilter.On       = FilterKeyEnum.From;
            fromFilter.Operator = FilterOperatorEnum.Equals;
            fromFilter.Value    = "*****@*****.**";

            TestObject.Filters.Add(fromFilter);
            PrepareLogger();

            Assert.IsFalse(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
예제 #14
0
        public void FilterFromStartsWithTest()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterFromStartsWithTest Subject", "FilterFromStartsWithTest Body");

            var fromFilter = new Filter
            {
                On       = FilterKeyEnum.From,
                Operator = FilterOperatorEnum.StartsWith,
                Value    = "alice"
            };

            TestObject.Filters.Add(fromFilter);
            PrepareLogger();

            Assert.IsTrue(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
예제 #15
0
        public void FilterFromEndsWithTestFailed()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterFromEndsWithTestFailed Subject", "FilterFromEndsWithTestFailed Body");

            var fromFilter = new Filter
            {
                On       = FilterKeyEnum.From,
                Operator = FilterOperatorEnum.EndsWith,
                Value    = "*****@*****.**"
            };

            TestObject.Filters.Add(fromFilter);
            PrepareLogger();

            Assert.IsFalse(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
예제 #16
0
        public void FilterSubjectEqualsTest()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterSubjectEqualsTest Subject", "FilterSubjectEqualsTest Body");

            var subjectFilter = new Filter
            {
                On       = FilterKeyEnum.Subject,
                Operator = FilterOperatorEnum.Equals,
                Value    = "FilterSubjectEqualsTest Subject"
            };

            TestObject.Filters.Add(subjectFilter);
            PrepareLogger();

            Assert.IsTrue(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
예제 #17
0
        public void FilterFromNotEqualsTest()
        {
            var emailMessage = EmailMessageHelper.CreateTextEmailMessage("FilterFromNotEqualsTest Subject", "FilterFromNotEqualsTest Body");

            var fromFilter = new Filter
            {
                On       = FilterKeyEnum.From,
                Operator = FilterOperatorEnum.NotEquals,
                Value    = "*****@*****.**"
            };

            TestObject.Filters.Add(fromFilter);
            PrepareLogger();

            Assert.IsTrue(TestObject.AppliesTo(new EmailItem(emailMessage)));
        }
 public void EmailItemNullTest()
 {
     PrepareLogger();
     Assert.IsFalse(TestObject.AppliesTo());
 }