public async Task PostAsync_ReturnsOkResult_When_RequestData_HasBothCNPandNWNPData() { //Arrange var controller = new NoticeController(_service.Object, _mockLogger.Object, _confOptions); var data = new NoticePayCompositeCalculationRequestModel() { Cnp = CompensatoryNoticePayControllerTestsDataGenerator.GetValidRequest(), Nwnp = new List <NoticeWorkedNotPaidCalculationRequestModel>() { NoticeWorkedNotPaidControllerTestsDataGenerator.GetValidRP1Request(), NoticeWorkedNotPaidControllerTestsDataGenerator.GetValidRP14aRequest() } }; var response = new NoticePayCompositeCalculationResponseDTO(); _service.Setup(s => s.PerformNoticePayCompositeCalculationAsync(data, _confOptions)) .ReturnsAsync(It.IsAny <NoticePayCompositeCalculationResponseDTO>()); //Act var result = await controller.PostAsync(data); //Assert var okRequestObjectRequest = result.Should().BeOfType <OkObjectResult>().Subject; _mockLogger.Verify(x => x.Log( LogLevel.Information, It.IsAny <EventId>(), It.Is <object>(v => v.ToString().Contains("Calculation performed successfully for the request data provided")), null, It.IsAny <Func <object, Exception, string> >() )); okRequestObjectRequest.StatusCode.Should().Be((int)System.Net.HttpStatusCode.OK); }
public async Task GetAdjustedWeeklyWage_Returns_AdjustedWeeklyWage_When_NoticeWorkedNotPaidClaimAmount_Is_NotZero_RP1() { //Arrange //N.B weekly wage in request data is 150 NOT zero var requestData = NoticeWorkedNotPaidControllerTestsDataGenerator.GetValidRP1Request(); //Act var result = await requestData.WeeklyWage.GetAdjustedWeeklyWageAsync (requestData.ShiftPattern, requestData.UnpaidPeriodFrom, requestData.UnpaidPeriodTo, requestData.ApClaimAmount); //Assert result.Should().Be(38.461538461538461538461538462M); }
public async Task GetAdjustedWeeklyWage_Returns_AdjustedWeeklyWage_When_NoticeWorkedNotPaidClaimAmountIsZero_RP14A() { //Arrange var requestData = NoticeWorkedNotPaidControllerTestsDataGenerator.GetValidRP14aRequest(); var apClaimAmount = 0.0m; var adjustedPeriodFrom = await requestData.UnpaidPeriodFrom.GetAdjustedPeriodFromAsync(requestData.InsolvencyDate); var adjustedPeriodTo = await requestData.UnpaidPeriodFrom.GetAdjustedPeriodToAsync(requestData.InsolvencyDate, requestData.DismissalDate); //Act var result = await requestData.WeeklyWage.GetAdjustedWeeklyWageAsync(requestData.ShiftPattern, adjustedPeriodFrom, adjustedPeriodTo, apClaimAmount); //Assert result.Should().Be(requestData.WeeklyWage); }