public async Task WhenRetrivingCostEstimationItShouldCallRequiredService()
        {
            //Act
            var estimationViewModel = await _estimationOrchestrator.CostEstimation(HashedAccountId, EstimationName, false);

            // Assert
            _autoMoq.Verify <IHashingService>(o => o.DecodeValue(HashedAccountId));
            _autoMoq.Verify <IAccountEstimationRepository>(o => o.Get(It.IsAny <long>()));
            _autoMoq.Verify <IAccountEstimationProjectionRepository>(o => o.Get(It.IsAny <AccountEstimation>()));
        }
コード例 #2
0
        public async Task Then_The_Cost_Takes_Into_Account_The_Actual_And_Estimated_Payments(
            decimal actualTotalCostOfTraining,
            decimal actualCommittedCompletionPayments,
            decimal transferOutTotalCostOfTraining,
            decimal transferOutCompletionPayment)
        {
            var expectedAccountEstimationProjectionList = new List <AccountEstimationProjectionModel>
            {
                new AccountEstimationProjectionModel
                {
                    Year        = (short)_dateFrom.Year,
                    Month       = (short)_dateFrom.Month,
                    ActualCosts = new AccountEstimationProjectionModel.Cost
                    {
                        TransferOutCostOfTraining     = 50,
                        TransferOutCompletionPayments = 50,
                    },
                    TransferModelledCosts = new AccountEstimationProjectionModel.Cost
                    {
                        TransferOutCostOfTraining     = 50,
                        TransferOutCompletionPayments = 50,
                    }
                },
                new AccountEstimationProjectionModel
                {
                    Year        = (short)_dateFrom.AddMonths(1).Year,
                    Month       = (short)_dateFrom.AddMonths(1).Month,
                    ActualCosts = new AccountEstimationProjectionModel.Cost
                    {
                        TransferOutCostOfTraining     = actualTotalCostOfTraining,
                        TransferOutCompletionPayments = actualCommittedCompletionPayments,
                    },
                    TransferModelledCosts = new AccountEstimationProjectionModel.Cost
                    {
                        TransferOutCostOfTraining     = transferOutTotalCostOfTraining,
                        TransferOutCompletionPayments = transferOutCompletionPayment,
                    }
                }
            };

            _mocker.GetMock <IAccountEstimationProjection>()
            .Setup(x => x.Projections)
            .Returns(expectedAccountEstimationProjectionList.AsReadOnly);

            var actual = await _orchestrator.CostEstimation("ABC123", "Test-Estimation", false);

            Assert.AreEqual(actualTotalCostOfTraining + actualCommittedCompletionPayments, actual.TransferAllowances.Records.First().ActualCost);
            Assert.AreEqual(transferOutTotalCostOfTraining + transferOutCompletionPayment, actual.TransferAllowances.Records.First().EstimatedCost);
        }