Exemplo n.º 1
0
        public void Validate_MessageMatchTheFiltersForLessOrEqualPatternWithWrongData_ReturnException()
        {
            var notificationFiltersValidator = new NotificationFiltersValidator();
            var message = new FieldsContainer();

            message.Add("Message", "text110");

            var filters = new Filters
            {
                FilterParams = new[]
                {
                    new FilterInfo
                    {
                        ColumnName           = "Message",
                        Patterns             = new[] { "110" },
                        MatchPatternOperator = "<="
                    }
                }
            };

            notificationFiltersValidator.SetFilters(filters);

            Action result = () => notificationFiltersValidator.Validate(message);

            result.Should().Throw <FormatException>().WithMessage("Nieprawidłowy format ciągu wejściowego.");
        }
Exemplo n.º 2
0
        public void Validate_MessageIsNull_ReturnFalse()
        {
            var notificationFiltersValidator = new NotificationFiltersValidator();
            var message = new FieldsContainer();

            notificationFiltersValidator.SetFilters(_filters);

            notificationFiltersValidator.Validate(message).Should().BeFalse();
        }
Exemplo n.º 3
0
        public void Validate_MessageMatchTheFiltersForDefaultPattern_ReturnTrue()
        {
            var notificationFiltersValidator = new NotificationFiltersValidator();
            var message = new FieldsContainer();

            message.Add("Message", "Critical");

            notificationFiltersValidator.SetFilters(_filters);

            notificationFiltersValidator.Validate(message).Should().BeTrue();
        }
Exemplo n.º 4
0
        public void Validate_MessageMatchTheFiltersForLessOrEqualPattern_ReturnTrue()
        {
            var notificationFiltersValidator = new NotificationFiltersValidator();
            var message = new FieldsContainer();

            message.Add("Message", "110");

            var filters = new Filters
            {
                FilterParams = new[]
                {
                    new FilterInfo
                    {
                        ColumnName           = "Message",
                        Patterns             = new[] { "110" },
                        MatchPatternOperator = "<="
                    }
                }
            };

            notificationFiltersValidator.SetFilters(filters);

            notificationFiltersValidator.Validate(message).Should().BeTrue();
        }
Exemplo n.º 5
0
        public void Validate_FiltersIsNull_ReturnFalse()
        {
            var notificationFiltersValidator = new NotificationFiltersValidator();

            notificationFiltersValidator.Validate(null).Should().BeFalse();
        }