예제 #1
0
        public void ShouldFailGenderRuleBadData()
        {
            _fixture = new GenderRule(DateTime.MinValue, DateTime.MaxValue, 1);
            var data = new Dictionary <string, object> {
                { "GenderId", "MALE" }
            };
            var ex = Assert.Throws <InvalidDataException>(() => _fixture.RulePasses(data));

            Assert.AreEqual("Invalid data provided to Gender Rule.", ex.Message);
        }
예제 #2
0
        public void ShouldPassInactiveGenderRulePastEndDate()
        {
            _fixture = new GenderRule(DateTime.MinValue, DateTime.Today.AddDays(-1), 1);
            var data = new Dictionary <string, object> {
                { "GenderId", 1 }
            };
            var result = _fixture.RulePasses(data);

            Assert.IsTrue(result.RulePassed);
            Assert.AreEqual("Rule Not Active", result.Message);
        }
예제 #3
0
        public void ShouldFailGenderRule()
        {
            _fixture = new GenderRule(DateTime.MinValue, DateTime.MaxValue, 1);
            var data = new Dictionary <string, object> {
                { "GenderId", 2 }
            };
            var result = _fixture.RulePasses(data);

            Assert.IsFalse(result.RulePassed);
            Assert.AreEqual("Gender must be 1", result.Message);
        }
예제 #4
0
        public void ShouldPassInactiveGenderRuleFutureStartDate()
        {
            _fixture = new GenderRule(DateTime.MaxValue, null, 1);
            var data = new Dictionary <string, object> {
                { "GenderId", 1 }
            };
            var result = _fixture.RulePasses(data);

            Assert.IsTrue(result.RulePassed);
            Assert.AreEqual("Rule Not Active", result.Message);
        }