public void ShouldWorkNormally()
        {
            // Arrange
            var testAmount   = 5555;
            var regionId     = Guid.NewGuid();
            var openFiscaLib = A.Fake <IOpenFisca>();

            var openFiscaResult = new OpenFiscaResource();

            openFiscaResult.CreatePerson("test_person");
            openFiscaResult.SetProp("test_person", OF.MaternityBenefitsAmount, testAmount);

            A.CallTo(() => openFiscaLib.Calculate(A <OpenFiscaResource> ._))
            .Returns(openFiscaResult);

            // Act
            var sut = new MaternityBenefitsOpenFiscaCalculator(openFiscaLib);

            var rule = new MaternityBenefitsCase()
            {
                MaxWeeklyAmount = 500,
                NumWeeks        = 10,
                Percentage      = 50,
            };
            var person = new MaternityBenefitsPerson()
            {
                AverageIncome = 1000
            };
            var result = sut.Calculate(rule, person);

            // Assert
            Assert.Equal(testAmount, result);
        }
예제 #2
0
 public static CaseRequest Convert(MaternityBenefitsCase caseModel)
 {
     return(new CaseRequest()
     {
         NumWeeks = caseModel.NumWeeks,
         MaxWeeklyAmount = caseModel.MaxWeeklyAmount,
         Percentage = caseModel.Percentage
     });
 }
        public void ShouldWorkNormally()
        {
            // Arrange

            // Act
            var sut = new MaternityBenefitsDefaultCalculator();

            var rule = new MaternityBenefitsCase()
            {
                MaxWeeklyAmount = 500,
                Percentage      = 55,
                NumWeeks        = 10
            };
            var person = new MaternityBenefitsPerson()
            {
                AverageIncome = 1000
            };
            var result = sut.Calculate(rule, person);

            // Assert
            Assert.Equal(5000, result);
        }