public void ValidateRules_ShouldReturnTrue_WhenAllRulesPass() { // Arrange var worker = new HoneypotWorker(); Honeypot.CustomRules.Clear(); Func<NameValueCollection, bool> rule = (form) => false; Honeypot.CustomRules.Add(rule); //Act bool isValid = worker.ValidateRules(new NameValueCollection()); // Assert Assert.True(isValid); }
public void ValidateRules_ShouldReturnTrue_WhenThereAreNoRules() { // Arrange var worker = new HoneypotWorker(); Honeypot.CustomRules.Clear(); //Act bool isValid = worker.ValidateRules(new NameValueCollection()); // Assert Assert.True(isValid); }
public void ValidateRules_ShouldReturnFalse_WhenAnyRuleFails() { // Arrange var worker = new HoneypotWorker(); Honeypot.CustomRules.Clear(); Func<NameValueCollection, bool> passingRule = (form) => false; Func<NameValueCollection, bool> failingRule = (form) => true; Honeypot.CustomRules.Add(passingRule); Honeypot.CustomRules.Add(failingRule); Honeypot.CustomRules.Add(passingRule); //Act bool isValid = worker.ValidateRules(new NameValueCollection()); // Assert Assert.False(isValid); }