public void CaseWithTwoServices_CoPaymentApplied_LimitApplied_CausePreviousConsumptions() { //given var medCase = new Case { Number = "CASE_1", InsuredId = 1, PolicyId = 9, Services = new List <CaseService> { new CaseService { ServiceCode = "KONS_INTERNISTA", Date = new DateTime(2019, 1, 10), Price = Money.Euro(100), Qt = 1 }, new CaseService { ServiceCode = "KONS_LARYNGOLOG", Date = new DateTime(2019, 1, 10), Price = Money.Euro(200), Qt = 1 } } }; //and var container = new IndividualInsuredConsumptionContainerForService ( 9, "KONS_INTERNISTA", 1, Period.Between(new DateTime(2019, 1, 1), new DateTime(2019, 12, 31)) ); container.ReserveLimitsFor("CASE8777", Guid.NewGuid(), new DateTime(2019, 1, 9), Money.Euro(950), 0); dataStore.LimitConsumptionContainers.Add(container); //when var result = cmdHandler.Handle(new CalculateCostSplitAndReserveLimitsCommand(medCase)); //then Assert.Equal(Money.Euro(50), result.CostSplitForCaseService(medCase.Services[0]).InsuredCost); Assert.Equal(Money.Euro(50), result.CostSplitForCaseService(medCase.Services[0]).TuCost); Assert.Equal(Money.Euro(100), result.CostSplitForCaseService(medCase.Services[0]).TotalCost); Assert.Equal(Money.Euro(50), result.CostSplitForCaseService(medCase.Services[0]).AmountLimitConsumption); Assert.Equal(Money.Euro(20), result.CostSplitForCaseService(medCase.Services[1]).InsuredCost); Assert.Equal(Money.Euro(180), result.CostSplitForCaseService(medCase.Services[1]).TuCost); Assert.Equal(Money.Euro(200), result.CostSplitForCaseService(medCase.Services[1]).TotalCost); Assert.Equal(Money.Euro(180), result.CostSplitForCaseService(medCase.Services[1]).AmountLimitConsumption); }
public void AmountLimitExceeded_WithPreviousConsumptions() { //given var medCase = new Case { Number = "CASE_1", InsuredId = 1, PolicyId = 7, Services = new List <CaseService> { new CaseService { ServiceCode = "KONS_INTERNISTA", Date = new DateTime(2019, 1, 10), Price = Money.Euro(200), Qt = 1 } } }; //and var container = new IndividualInsuredConsumptionContainerForService ( 7, "KONS_INTERNISTA", 1, Period.Between(new DateTime(2019, 1, 1), new DateTime(2019, 12, 31)) ); container.ReserveLimitsFor("CASE8777", Guid.NewGuid(), new DateTime(2019, 1, 9), Money.Euro(400), 0); dataStore.LimitConsumptionContainers.Add(container); //when var result = cmdHandler.Handle(new CalculateCostSplitAndReserveLimitsCommand(medCase)); //then Assert.Equal(Money.Euro(100), result.InsuredCost); Assert.Equal(Money.Euro(100), result.TuCost); Assert.Equal(Money.Euro(200), result.TotalCost); Assert.Equal(Money.Euro(100), result.AmountLimitConsumption); //TODO: ? czy to ma byc total zuzycie czy tylko z tego case'a }