public void Arrange() { _mediator = new Mock <IMediator>(); _logger = new Mock <ILog>(); _cookieService = new Mock <ICookieStorageService <EmployerAccountData> >(); _configuration = new EmployerAccountsConfiguration(); _employerAccountOrchestrator = new EmployerAccountOrchestrator( _mediator.Object, _logger.Object, _cookieService.Object, _configuration); _mediator.Setup(x => x.SendAsync(It.IsAny <GetUserAccountsQuery>())) .ReturnsAsync(new GetUserAccountsQueryResponse() { Accounts = new Accounts <Account> { AccountsCount = 1, AccountList = new List <Account> { new Account { HashedId = _existingAccountHashedId } } } }); }
public void Arrange() { _mediator = new Mock <IMediator>(); _logger = new Mock <ILog>(); _cookieService = new Mock <ICookieStorageService <EmployerAccountData> >(); _configuration = new EmployerAccountsConfiguration(); _employerAccountOrchestrator = new EmployerAccountOrchestrator( _mediator.Object, _logger.Object, _cookieService.Object, _configuration); _mediator.Setup(x => x.SendAsync(It.IsAny <GetUserAccountsQuery>())) .ReturnsAsync(new GetUserAccountsQueryResponse() { Accounts = new Accounts <Account>() }); _mediator.Setup(x => x.SendAsync(It.IsAny <CreateUserAccountCommand>())) .ReturnsAsync(new CreateUserAccountCommandResponse() { HashedAccountId = "ABS10" }); }
public void Arrange() { _cookieService = new Mock <ICookieStorageService <EmployerAccountData> >(); _logger = new Mock <ILogger>(); _mediator = new Mock <IMediator>(); _configuration = new EmployerApprenticeshipsServiceConfiguration(); _account = new Account { Id = 123, HashedId = "ABC123", Name = "Test Account" }; _mediator.Setup(x => x.SendAsync(It.IsAny <GetEmployerAccountHashedQuery>())) .ReturnsAsync(new GetEmployerAccountResponse { Account = _account }); _mediator.Setup(x => x.SendAsync(It.IsAny <GetUserAccountRoleQuery>())) .ReturnsAsync(new GetUserAccountRoleResponse { UserRole = Role.Owner }); _orchestrator = new EmployerAccountOrchestrator(_mediator.Object, _logger.Object, _cookieService.Object, _configuration); }
public EmployerAccountController(IAuthenticationService owinWrapper, EmployerAccountOrchestrator employerAccountOrchestrator, IAuthorizationService authorization, IMultiVariantTestingService multiVariantTestingService, ILog logger, ICookieStorageService <FlashMessageViewModel> flashMessage) : base(owinWrapper, multiVariantTestingService, flashMessage) { _employerAccountOrchestrator = employerAccountOrchestrator; _logger = logger; }
public void Arrange() { _mediator = new Mock <IMediator>(); _logger = new Mock <ILogger>(); _cookieService = new Mock <ICookieStorageService <EmployerAccountData> >(); _configuration = new EmployerApprenticeshipsServiceConfiguration(); _employerAccountOrchestrator = new EmployerAccountOrchestrator(_mediator.Object, _logger.Object, _cookieService.Object, _configuration); }
public void Arrange() { _logger = new Mock <ILog>(); _mediator = new Mock <IMediator>(); _cookieService = new Mock <ICookieStorageService <EmployerAccountData> >(); _configuration = new EmployerAccountsConfiguration { Hmrc = new HmrcConfiguration() }; _employerAccountOrchestrator = new EmployerAccountOrchestrator(_mediator.Object, _logger.Object, _cookieService.Object, _configuration, Mock.Of <IHashingService>()); }
public EmployerAccountController(IOwinWrapper owinWrapper, EmployerAccountOrchestrator employerAccountOrchestrator, IFeatureToggle featureToggle, IMultiVariantTestingService multiVariantTestingService, ILogger logger, ICookieStorageService <FlashMessageViewModel> flashMessage) : base(owinWrapper, featureToggle, multiVariantTestingService, flashMessage) { if (employerAccountOrchestrator == null) { throw new ArgumentNullException(nameof(employerAccountOrchestrator)); } _employerAccountOrchestrator = employerAccountOrchestrator; _logger = logger; }
public static void CreateDasAccount(UserViewModel userView, EmployerAccountOrchestrator orchestrator) { orchestrator.CreateAccount(new CreateAccountViewModel { UserId = userView.UserRef, AccessToken = Guid.NewGuid().ToString(), RefreshToken = Guid.NewGuid().ToString(), OrganisationDateOfInception = new DateTime(2016, 01, 01), PayeReference = $"{Guid.NewGuid().ToString().Substring(0, 3)}/{Guid.NewGuid().ToString().Substring(0, 7)}", OrganisationName = "Test Company", OrganisationReferenceNumber = "123456TGB" + Guid.NewGuid().ToString().Substring(0, 6), OrganisationAddress = "Address Line 1", OrganisationStatus = "active" }, new Mock <HttpContextBase>().Object).Wait(); }
public EmployerAccountController(IAuthenticationService owinWrapper, EmployerAccountOrchestrator employerAccountOrchestrator, IMultiVariantTestingService multiVariantTestingService, ILog logger, ICookieStorageService <FlashMessageViewModel> flashMessage, IMediator mediatr, ICookieStorageService <ReturnUrlModel> returnUrlCookieStorageService, ICookieStorageService <HashedAccountIdModel> accountCookieStorage) : base(owinWrapper, multiVariantTestingService, flashMessage) { _employerAccountOrchestrator = employerAccountOrchestrator; _logger = logger; _mediatr = mediatr ?? throw new ArgumentNullException(nameof(mediatr)); _returnUrlCookieStorageService = returnUrlCookieStorageService; _accountCookieStorage = accountCookieStorage; _hashedAccountIdCookieName = typeof(HashedAccountIdModel).FullName; }
public void Arrange() { _mediator = new Mock <IMediator>(); _logger = new Mock <ILog>(); _cookieService = new Mock <ICookieStorageService <EmployerAccountData> >(); _configuration = new EmployerAccountsConfiguration(); _employerAccountOrchestrator = new EmployerAccountOrchestrator(_mediator.Object, _logger.Object, _cookieService.Object, _configuration); _mediator.Setup(x => x.SendAsync(It.IsAny <CreateLegalEntityCommand>())).ReturnsAsync(new CreateLegalEntityCommandResponse { AgreementView = new EmployerAgreementView() }); _mediator.Setup(x => x.SendAsync(It.IsAny <CreateAccountCommand>())) .ReturnsAsync(new CreateAccountCommandResponse() { HashedAccountId = "ABS10" }); }
public void CreateAccountWithOwner(EmployerAccountOrchestrator orchestrator, IMediator mediator, Mock <IOwinWrapper> owinWrapper, HomeOrchestrator homeOrchestrator) { var accountOwnerUserId = Guid.NewGuid().ToString(); ScenarioContext.Current["AccountOwnerUserId"] = accountOwnerUserId; var signInUserModel = new UserViewModel { UserId = accountOwnerUserId, Email = "*****@*****.**" + Guid.NewGuid().ToString().Substring(0, 6), FirstName = "Test", LastName = "Tester" }; var userCreationSteps = new UserSteps(); userCreationSteps.UpsertUser(signInUserModel); var user = userCreationSteps.GetExistingUserAccount(); CreateDasAccount(user, _container.GetInstance <EmployerAccountOrchestrator>()); }