Exemple #1
0
        public async Task Should_not_error_if_value_is_allowed()
        {
            var sut = new AllowedValuesValidator <int>(100, 200);

            await sut.ValidateAsync(100, false, errors.Add);

            Assert.Equal(0, errors.Count);
        }
Exemple #2
0
        public async Task Should_add_error_if_value_is_not_allowed()
        {
            var sut = new AllowedValuesValidator <int>(100, 200);

            await sut.ValidateAsync(50, false, errors.Add);

            errors.ShouldBeEquivalentTo(
                new[] { "<FIELD> is not an allowed value" });
        }