public void Arrange() { _mocker = new AutoMoqer(); _mocker.GetMock <IHashingService>() .Setup(x => x.DecodeValue(It.IsAny <string>())) .Returns(ExpectedAccountId); _mocker.GetMock <CurrentBalance>() .Setup(x => x.RefreshBalance(It.IsAny <bool>(), It.IsAny <bool>())).ReturnsAsync(true); _mocker.GetMock <ICurrentBalanceRepository>() .Setup(x => x.Get(ExpectedAccountId)) .ReturnsAsync(_mocker.Resolve <CurrentBalance>()); _mocker.GetMock <IAccountEstimationProjection>() .Setup(x => x.Projections) .Returns(new List <AccountEstimationProjectionModel>().AsReadOnly); _mocker.GetMock <IAccountEstimationProjection>() .Setup(x => x.TransferAllowance) .Returns(400m); _accountEstimationProjection = _mocker.Resolve <IAccountEstimationProjection>(); _mocker.GetMock <IAccountEstimationProjectionRepository>() .Setup(x => x.Get(It.IsAny <AccountEstimation>(), false)) .ReturnsAsync(_accountEstimationProjection); _mocker.GetMock <IExpiredFundsService>() .Setup(s => s.GetExpiringFunds(It.IsAny <ReadOnlyCollection <AccountEstimationProjectionModel> >(), It.IsAny <long>(), It.IsAny <ProjectionGenerationType>(), It.IsAny <DateTime>())).ReturnsAsync(new Dictionary <CalendarPeriod, decimal>()); _orchestrator = _mocker.Resolve <EstimationOrchestrator>(); }
public void Setup() { _autoMoq = new AutoMoqer(); var _model = new AccountEstimationModel { Id = Guid.NewGuid().ToString("N"), Apprenticeships = new List <VirtualApprenticeship>(), EmployerAccountId = AccountId, EstimationName = "default" }; var p = _autoMoq.GetMock <IAccountEstimationProjection>(); p.Setup(x => x.BuildProjections()).Verifiable(); IList <AccountProjectionReadModel> projectionModel = new List <AccountProjectionReadModel> { new AccountProjectionReadModel { EmployerAccountId = 10000, Month = 4, Year = 2018, FutureFunds = 15000m, TotalCostOfTraining = 0m } }; p.Setup(o => o.Projections) .Returns(new ReadOnlyCollection <AccountProjectionReadModel>(projectionModel)); _autoMoq.SetInstance(_model); _autoMoq.GetMock <IHashingService>() .Setup(o => o.DecodeValue(HashedAccountId)) .Returns(AccountId); _autoMoq.GetMock <IAccountEstimationRepository>() .Setup(x => x.Get(It.IsAny <long>())) .Returns(Task.FromResult(_autoMoq.Resolve <AccountEstimation>())); _autoMoq.GetMock <IAccountEstimationProjectionRepository>() .Setup(x => x.Get(It.IsAny <AccountEstimation>())) .Returns(Task.FromResult(p.Object)); _estimationOrchestrator = _autoMoq.Resolve <EstimationOrchestrator>(); }