public async Task PostAsync_Returns_NotEligibleRedundancyPaymentCalculationResponse()
        {
            //Arrange
            var requestData = new RedundancyPaymentCalculationRequestModel
            {
                EmploymentStartDate = new DateTime(2015, 10, 11),
                DismissalDate       = new DateTime(2016, 08, 05),
                DateNoticeGiven     = new DateTime(2016, 08, 05),
                DateOfBirth         = new DateTime(1995, 03, 11),
                WeeklyWage          = 203.64m,
                EmployerPartPayment = 0,
                EmploymentBreaks    = 0
            };

            //Act
            var redundancyPayController =
                new RedundancyPaymentController(_mockService.Object, _mockLogger.Object, _confOptions);

            //Assert
            var result = await redundancyPayController.PostAsync(requestData);

            var badRequest = result.Should().BeOfType <BadRequestObjectResult>().Subject;
            var statusCode = badRequest.StatusCode.Should().Be((int)System.Net.HttpStatusCode.BadRequest);

            _mockLogger.Verify(x => x.Log(
                                   LogLevel.Error,
                                   It.IsAny <EventId>(),
                                   It.Is <object>(v => v.ToString().Contains("Years of service cannot be less than 2 years")),
                                   null,
                                   It.IsAny <Func <object, Exception, string> >()
                                   ));
        }
        public async Task PostAsync_Fails_IfClaimReceptDateIsAfterDismissalDatePlus6Months()
        {
            //Arrange
            var requestData = new RedundancyPaymentCalculationRequestModel
            {
                EmploymentStartDate = new DateTime(2015, 10, 11),
                DismissalDate       = new DateTime(2016, 08, 05),
                DateNoticeGiven     = new DateTime(2016, 08, 05),
                ClaimReceiptDate    = new DateTime(2017, 2, 06),
                DateOfBirth         = new DateTime(1995, 03, 11),
                WeeklyWage          = 203.64m,
                EmployerPartPayment = 0,
                EmploymentBreaks    = 0
            };

            //Act
            var redundancyPayController =
                new RedundancyPaymentController(_mockService.Object, _mockLogger.Object, _confOptions);

            //Assert
            var result = await redundancyPayController.PostAsync(requestData);

            var badRequest = result.Should().BeOfType <BadRequestObjectResult>().Subject;
            var statusCode = badRequest.StatusCode.Should().Be((int)System.Net.HttpStatusCode.BadRequest);

            _mockLogger.Verify(x => x.Log(
                                   LogLevel.Error,
                                   It.IsAny <EventId>(),
                                   It.Is <object>(v => v.ToString().Contains("Claim Receipt Date must be within 6 months of the dismissal date")),
                                   null,
                                   It.IsAny <Func <object, Exception, string> >()
                                   ));
        }
        public async Task PostAsync_Returns_RedundancyPaymentCalculationResponseDTO()
        {
            //Arrange
            var requestData = _redundancyPaymentControllerTestDataGenerator.GetValidRequestData();

            //Setup
            var responseData = _redundancyPaymentControllerTestDataGenerator.GetValidCalculationResults();

            _mockService.Setup(s => s.PerformRedundancyPayCalculationAsync(requestData, _confOptions))
            .ReturnsAsync(responseData);

            //Act
            var redundancyPayController =
                new RedundancyPaymentController(_mockService.Object, _mockLogger.Object, _confOptions);

            //Assert
            var result =
                await redundancyPayController.PostAsync(requestData);

            var okObjectResult = result.Should().BeOfType <OkObjectResult>().Subject;

            okObjectResult.StatusCode.Should().Be((int)System.Net.HttpStatusCode.OK);
            var responseDto = okObjectResult.Value.Should()
                              .BeOfType <RedundancyPaymentResponseDto>().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> >()
                                   ));
        }
        public async Task PostAsync_ReturnsBadRequest_ForNullData()
        {
            //Arrange
            var requestData = _redundancyPaymentControllerTestDataGenerator.GetNullData();

            //Act
            var redundancyPayController =
                new RedundancyPaymentController(_mockService.Object, _mockLogger.Object, _confOptions);
            //Assert
            var result = await redundancyPayController.PostAsync(requestData);

            var badRequest = result.Should().BeOfType <BadRequestObjectResult>().Subject;
            var statusCode = badRequest.StatusCode.Should().Be((int)System.Net.HttpStatusCode.BadRequest);

            _mockLogger.Verify(x => x.Log(
                                   LogLevel.Error,
                                   It.IsAny <EventId>(),
                                   It.Is <object>(v => v.ToString().Contains("Request Data is null and could not be parsed")),
                                   null,
                                   It.IsAny <Func <object, Exception, string> >()
                                   ));
        }