Exemplo n.º 1
0
        public void ValidationFailsWhenSalaryFromIsGreaterThanSalaryTo()
        {
            var model = new FilterModel
            {
                SalaryFrom = 1000,
                SalaryTo   = 10,
            };

            var errorsCount = model.Validate(null).Count();

            Assert.True(errorsCount > 0);
        }
Exemplo n.º 2
0
        public void ValidationFailsWhenValidFromDateIsGreaterThanValidUntil()
        {
            var model = new FilterModel
            {
                ValidFrom  = DateTime.UtcNow,
                ValidUntil = DateTime.UtcNow.AddDays(-3),
            };

            var errorsCount = model.Validate(null).Count();

            Assert.True(errorsCount > 0);
        }
Exemplo n.º 3
0
        public void ValidationPassesWhenDatesAndSalariesAreCorrect()
        {
            var model = new FilterModel
            {
                ValidFrom  = DateTime.UtcNow,
                ValidUntil = DateTime.UtcNow.AddDays(1),
                SalaryFrom = 10,
                SalaryTo   = 1000,
            };

            var errorsCount = model.Validate(null).Count();

            Assert.Equal(0, errorsCount);
        }
Exemplo n.º 4
0
        public void ValidationReturnsMultipleErrorCountWhenDatesAndSalariesAreNotCorrect()
        {
            var model = new FilterModel
            {
                ValidFrom  = DateTime.UtcNow,
                ValidUntil = DateTime.UtcNow.AddDays(-4),
                SalaryFrom = 1000,
                SalaryTo   = 10,
            };

            var errorsCount = model.Validate(null).Count();

            Assert.True(errorsCount > 1);
        }