public void RemoveRisk(string nameOfInsuredObject, Risk risk, DateTime validTill, DateTime effectiveDate) { if (validTill.Date < DateTime.Now.Date) { throw new RiskRemovalDateException(); } _riskService.RemoveRisk(nameOfInsuredObject, risk, validTill, effectiveDate); }
public void RemoveRisk_ShouldCallPolicyRepositoryGet() { PolicyRepositoryMock.Setup(mock => mock.Get(It.IsAny <string>())) .Returns(new PolicyModel() { ValidTill = EffectiveDate.AddMonths(6) }); RiskRepositoryMock.Setup(mock => mock.Get(It.IsAny <string>())) .Returns(new RiskModel() { }); RiskService.RemoveRisk(DEFAULT_OBJECT_NAME, new Risk() { Name = DEFAULT_RISK_NAME }, EffectiveDate.AddMonths(2), EffectiveDate); PolicyRepositoryMock.Verify(mock => mock.Get(It.IsAny <string>()), Times.Once); }