public void IsMatch_WithFailingRule_TriesAllRulesReturnsFalse() { var stump = new Stump("ABC"); var context = Substitute.For <IStumpsHttpContext>(); var request = Substitute.For <IStumpsHttpRequest>(); context.Request.Returns(request); var rule1 = Substitute.For <IStumpRule>(); rule1.IsMatch(request).Returns(true); var rule2 = Substitute.For <IStumpRule>(); rule2.IsMatch(request).Returns(false); stump.AddRule(rule1); stump.AddRule(rule2); stump.Responds(); var matches = stump.IsMatch(context); rule1.Received(1).IsMatch(request); rule2.Received(1).IsMatch(request); Assert.IsFalse(matches); }
public void IsMatch_WithoutRules_ReturnsFalse() { var stump = new Stump("ABC"); stump.Responds(); Assert.IsFalse(stump.IsMatch(Substitute.For <IStumpsHttpContext>())); }
public void IsMatch_WithNullContext_ReturnsFalse() { var stump = new Stump("ABC"); stump.Responds(); var rule1 = Substitute.For <IStumpRule>(); rule1.IsMatch(null).Returns(true); stump.AddRule(rule1); Assert.IsFalse(stump.IsMatch(null)); }