예제 #1
0
        public void ShouldFailRegistrationRuleBadData()
        {
            _fixture = new RegistrationRule(DateTime.MinValue, DateTime.MaxValue, 100);
            var data = new Dictionary <string, object> {
                { "registrantCount", "threeve" }
            };
            var ex = Assert.Throws <InvalidDataException>(() => _fixture.RulePasses(data));

            Assert.AreEqual("Invalid data provided to registration rule.", ex.Message);
        }
예제 #2
0
        public void ShouldPassInactiveRegistrationRulePastEndDate()
        {
            _fixture = new RegistrationRule(DateTime.MinValue, DateTime.Today.AddDays(-1), 100);
            var data = new Dictionary <string, object> {
                { "registrantCount", 1 }
            };
            var result = _fixture.RulePasses(data);

            Assert.IsTrue(result.RulePassed);
            Assert.AreEqual("Rule Not Active", result.Message);
        }
예제 #3
0
        public void ShouldFailRegistrationRule()
        {
            _fixture = new RegistrationRule(DateTime.MinValue, DateTime.MaxValue, 100);
            var data = new Dictionary <string, object> {
                { "registrantCount", 101 }
            };
            var result = _fixture.RulePasses(data);

            Assert.IsFalse(result.RulePassed);
            Assert.AreEqual("Exceeded Maximum of 100", result.Message);
        }
예제 #4
0
        public void ShouldPassRegistrationRuleNoEndDate()
        {
            _fixture = new RegistrationRule(DateTime.MinValue, null, 100);
            var data = new Dictionary <string, object> {
                { "registrantCount", 1 }
            };
            var result = _fixture.RulePasses(data);

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