public void Should_invoke_get_premium_if_canhandle() { var rule = Substitute.For <IInsuranceRule>(); var module = new InsuranceModule(() => rule, (x) => true); module.Handle(new InsuranceQuote()); rule.Received().GetPremium(Arg.Any <Premium>(), Arg.Any <InsuranceQuote>()); }
public void Should_return_null_if_cannot_handle() { var rule = Substitute.For <IInsuranceRule>(); var module = new InsuranceModule(() => rule, (x) => false); rule.GetPremium(Arg.Any <Premium>(), Arg.Any <InsuranceQuote>()).Returns(new Premium()); var result = module.Handle(new InsuranceQuote()); result.ShouldBe(null); }