Beispiel #1
0
        public void Feature_not_enabled_returns_is_valid_true()
        {
            var mockFeature = new Mock <IFilterPathwaysByAgeFeature>();

            mockFeature.Setup(f => f.IsEnabled).Returns(false);

            var sut = new AgeValidator <AgeGenderViewModel, int>(u => u.Age, mockFeature.Object);

            Assert.IsTrue(sut.IsAValidAge(24));
        }
Beispiel #2
0
        public void Feature_enabled_invalid_age_categories_throws_exception()
        {
            var mockFeature = new Mock <IFilterPathwaysByAgeFeature>();

            mockFeature.Setup(f => f.IsEnabled).Returns(true);
            mockFeature.Setup(f => f.FilteredAgeCategories).Returns(new[] { "x", "toddler" });

            var sut = new AgeValidator <AgeGenderViewModel, int>(u => u.Age, mockFeature.Object);

            Assert.IsTrue(sut.IsAValidAge(5));
        }
Beispiel #3
0
        public void Feature_enabled_exclude_infants_and_toddlers_age_5_returns_true()
        {
            var mockFeature = new Mock <IFilterPathwaysByAgeFeature>();

            mockFeature.Setup(f => f.IsEnabled).Returns(true);
            mockFeature.Setup(f => f.FilteredAgeCategories).Returns(new[] { "infant", "toddler" });

            var sut = new AgeValidator <AgeGenderViewModel, int>(u => u.Age, mockFeature.Object);

            Assert.IsTrue(sut.IsAValidAge(5));
        }
Beispiel #4
0
        public void Feature_enabled_empty_age_list_returns_is_valid_true()
        {
            var mockFeature = new Mock <IFilterPathwaysByAgeFeature>();

            mockFeature.Setup(f => f.IsEnabled).Returns(true);
            mockFeature.Setup(f => f.FilteredAgeCategories).Returns(new string[0]);

            var sut = new AgeValidator <AgeGenderViewModel, int>(u => u.Age, mockFeature.Object);

            Assert.IsTrue(sut.IsAValidAge(24));
        }