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); }
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); }
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); }
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); }