private async Task CreateLegalEntitiesForAccountsAsync(EmployerAccountSetup accountSetup) { foreach (var legalEntitySetup in accountSetup.LegalEntities) { legalEntitySetup.LegalEntityWithAgreementInputOutput = await CreateLegalEntityAsync(legalEntitySetup.LegalEntityWithAgreementInput); } }
public async Task Setup() { await InitialiseEmployerAccountData(async builder => { var data = new TestModelBuilder() .WithNewUser() .WithNewAccount() .WithNewLegalEntity(); await builder.SetupDataAsync(data); _employerAccount = data.CurrentAccount; }); WhenControllerActionIsCalled($"https://localhost:44330/api/accounts/{_employerAccount.AccountOutput.HashedAccountId}/legalentities"); }
public async Task Setup() { _tester = new ApiIntegrationTester(TestSetupIoC.CreateIoC); // Arrange await _tester.InitialiseData <EmployerAccountsDbBuilder>(async builder => { var data = new TestModelBuilder() .WithNewUser() .WithNewAccount() .WithNewLegalEntity(); await builder.SetupDataAsync(data); _employerAccount = data.CurrentAccount; }); }
/// <summary> /// Add the information to create a new account. The account will be available in the <see cref="CurrentAccount"/>. /// The account will be created for the user specified in <see cref="CurrentUser"/>. An exception /// will be thrown if a user has not been created (via <see cref="WithNewUser"/>. The account will not /// be persisted to the database until <see cref="EmployerAccountsDbBuilder.SetupDataAsync"/> is called. /// </summary> public TestModelBuilder WithNewAccount() { Contract.Assert(HasCurrentUser, "Add a user before adding an account"); var currentUser = CurrentUser; var account = _fixture .Build <EmployerAccountInput>() .With(input => input.UserId, () => currentUser.UserOutput.UserId) .Create(); var accountSetup = new EmployerAccountSetup { AccountInput = account }; currentUser.Accounts.Add(accountSetup); return(this); }