예제 #1
0
        public void ValidateFailRangeTest()
        {
            //pass count value > max
            PassCountSettings settings = PassCountSettings.CreatePassCountSettings(new[] { 1, 2, int.MaxValue });

            Assert.ThrowsException <ServiceException>(() => settings.Validate());
        }
예제 #2
0
        public void ValidateFailOrderTest()
        {
            //pass counts out of order
            PassCountSettings settings = PassCountSettings.CreatePassCountSettings(new[] { 1, 10, 5, 12, 3 });

            Assert.ThrowsException <ServiceException>(() => settings.Validate());
        }
예제 #3
0
        public void ValidateFailFirstTest()
        {
            //doesn't start at 0
            PassCountSettings settings = PassCountSettings.CreatePassCountSettings(new[] { 0, 5, 10 });

            Assert.ThrowsException <ServiceException>(() => settings.Validate());
        }
예제 #4
0
        public void ValidateFailLengthTest()
        {
            //empty array
            PassCountSettings settings = PassCountSettings.CreatePassCountSettings(new int[] {});

            Assert.ThrowsException <ServiceException>(() => settings.Validate());
        }
예제 #5
0
        public void CanCreatePassCountSettingsTest()
        {
            var validator = new DataAnnotationsValidator();
            PassCountSettings settings = PassCountSettings.CreatePassCountSettings(new[] { 1, 3, 5, 10 });

            Assert.IsTrue(validator.TryValidate(settings, out ICollection <ValidationResult> results));
        }
예제 #6
0
        public void ValidateSuccessTest()
        {
            PassCountSettings settings = PassCountSettings.CreatePassCountSettings(new[] { 1, 3, 5, 10 });

            settings.Validate();
        }