Пример #1
0
        public async Task ThenTheLastCalculationDateForEnglishFractionIsUpdatedIfItHasChanged()
        {
            //Arrange
            _mediator.Setup(x => x.SendAsync(It.Is <GetHMRCLevyDeclarationQuery>(c => c.EmpRef.Equals(ExpectedPayeRef)))).ReturnsAsync(GetHMRCLevyDeclarationResponseObjectMother.Create(ExpectedPayeRef));
            _mediator.Setup(x => x.SendAsync(It.IsAny <GetEnglishFractionUpdateRequiredRequest>()))
            .ReturnsAsync(new GetEnglishFractionUpdateRequiredResponse
            {
                UpdateRequired = true
            });

            //Act
            await _levyDeclaration.RunAsync(_cancellationTokenSource.Token);

            //Assert
            _mediator.Verify(x => x.SendAsync(It.IsAny <CreateEnglishFractionCalculationDateCommand>()), Times.Once);
        }
Пример #2
0
        public async Task ThenWhenTheDeclarationsEnabledConfigValueIsDeclarationsThenOnlyDeclarationsAreProcessed()
        {
            //Arrange
            ConfigurationManager.AppSettings["DeclarationsEnabled"] = "declarations";
            _mediator.Setup(x => x.SendAsync(It.Is <GetHMRCLevyDeclarationQuery>(c => c.EmpRef.Equals(ExpectedPayeRef)))).ReturnsAsync(GetHMRCLevyDeclarationResponseObjectMother.Create(ExpectedPayeRef));
            _mediator.Setup(x => x.SendAsync(It.IsAny <GetEnglishFractionUpdateRequiredRequest>()))
            .ReturnsAsync(new GetEnglishFractionUpdateRequiredResponse
            {
                UpdateRequired = true
            });

            //Act
            await _levyDeclaration.RunAsync(_cancellationTokenSource.Token);

            //Assert
            _mediator.Verify(x => x.SendAsync(It.IsAny <UpdateEnglishFractionsCommand>()), Times.Never);
            _mediator.Verify(x => x.SendAsync(It.IsAny <RefreshEmployerLevyDataCommand>()), Times.Once);
            _mediator.Verify(x => x.SendAsync(It.IsAny <GetHMRCLevyDeclarationQuery>()), Times.Once);
        }
Пример #3
0
        public async Task ThenWhenHmrcHaveUpdatedTheirEnglishFractionCalculationsIShouldUpdateTheLevyCalculations()
        {
            //Assign
            _mediator.Setup(x => x.SendAsync(It.Is <GetHMRCLevyDeclarationQuery>(c => c.EmpRef.Equals(ExpectedPayeRef)))).ReturnsAsync(GetHMRCLevyDeclarationResponseObjectMother.Create(ExpectedPayeRef));


            _mediator.Setup(x => x.SendAsync(It.IsAny <GetEnglishFractionUpdateRequiredRequest>()))
            .ReturnsAsync(new GetEnglishFractionUpdateRequiredResponse
            {
                UpdateRequired = true
            });

            //Act
            await _levyDeclaration.RunAsync(_cancellationTokenSource.Token);

            //Assert
            _mediator.Verify(x => x.SendAsync(It.IsAny <UpdateEnglishFractionsCommand>()), Times.Once);
        }
Пример #4
0
        public async Task ThenTheCallToUpdateExistingPayeInformationIsMadeForNewAndExistingSchemes(bool updateRequired)
        {
            //Arrange
            _mediator.Setup(x => x.SendAsync(It.Is <GetHMRCLevyDeclarationQuery>(c => c.EmpRef.Equals(ExpectedPayeRef)))).ReturnsAsync(GetHMRCLevyDeclarationResponseObjectMother.Create(ExpectedPayeRef));
            _mediator.Setup(x => x.SendAsync(It.IsAny <GetEnglishFractionUpdateRequiredRequest>()))
            .ReturnsAsync(new GetEnglishFractionUpdateRequiredResponse
            {
                UpdateRequired = updateRequired
            });

            //Act
            await _levyDeclaration.RunAsync(_cancellationTokenSource.Token);

            //Assert
            _dasAccountService.Verify(x => x.UpdatePayeScheme(ExpectedPayeRef), Times.Once);
        }