public ChooseOrganisationSteps(TestContext testContext) : base(testContext) { _testContext = testContext; _fixture = new Fixture(); var testData = new TestData.Account.WithSingleLegalEntityWithEligibleApprenticeships(); _accountId = testData.AccountId; _hashedAccountId = testData.HashedAccountId; _testContext.TestDataStore.Add("HashedAccountId", testData.HashedAccountId); _testContext.AddOrReplaceClaim(EmployerClaimTypes.Account, testData.HashedAccountId); }
public void GivenAnEmployerApplyingHasASingleLegalEntityWithEligibleApprenticeships() { var testdata = new TestData.Account.WithSingleLegalEntityWithEligibleApprenticeships(); _testDataStore.Add("HashedAccountId", testdata.HashedAccountId); _testContext.AddOrReplaceClaim(EmployerClaimTypes.Account, testdata.HashedAccountId); _testDataStore.Add("HashedAccountLegalEntityId", testdata.HashedAccountLegalEntityId); _testDataStore.Add("LegalEntity", testdata.LegalEntity); _testContext.EmployerIncentivesApi.MockServer .Given( Request .Create() .WithPath($"/accounts/{testdata.AccountId}/legalentities") .UsingGet() ) .RespondWith( Response.Create() .WithStatusCode(HttpStatusCode.OK) .WithBody(JsonConvert.SerializeObject(testdata.LegalEntities, TestHelper.DefaultSerialiserSettings))); _testContext.EmployerIncentivesApi.MockServer .Given( Request .Create() .WithPath($"/accounts/{testdata.AccountId}/legalentities/{testdata.AccountLegalEntityId}") .UsingGet() ) .RespondWith( Response.Create() .WithStatusCode(HttpStatusCode.OK) .WithBody(JsonConvert.SerializeObject(testdata.LegalEntities.First(), TestHelper.DefaultSerialiserSettings))); _testContext.EmployerIncentivesApi.MockServer .Given( Request .Create() .WithPath($"/apprenticeships") .WithParam("accountid", testdata.AccountId.ToString()) .WithParam("accountlegalentityid", testdata.LegalEntities.First().AccountLegalEntityId.ToString()) .UsingGet() ) .RespondWith( Response.Create() .WithBody(JsonConvert.SerializeObject(testdata.Apprentices, TestHelper.DefaultSerialiserSettings)) .WithStatusCode(HttpStatusCode.OK)); }
public EmployerIncentivesApiBuilder WithSingleLegalEntityWithEligibleApprenticeships() { var data = new TestData.Account.WithSingleLegalEntityWithEligibleApprenticeships(); _server .Given( Request .Create() .WithPath($"/accounts/{data.AccountId}/legalentities") .UsingGet() ) .RespondWith( Response.Create() .WithStatusCode(HttpStatusCode.OK) .WithBody(JsonConvert.SerializeObject(data.LegalEntities, TestHelper.DefaultSerialiserSettings))); _server .Given( Request .Create() .WithPath($"/accounts/{data.AccountId}/legalentities/{data.AccountLegalEntityId}") .UsingGet() ) .RespondWith( Response.Create() .WithStatusCode(HttpStatusCode.OK) .WithBody(JsonConvert.SerializeObject(data.LegalEntity, TestHelper.DefaultSerialiserSettings))); _server .Given( Request .Create() .WithPath($"/apprenticeships") .WithParam("accountid", data.AccountId.ToString()) .WithParam("accountlegalentityid", data.LegalEntities.First().AccountLegalEntityId.ToString()) .UsingGet() ) .RespondWith( Response.Create() .WithBody(JsonConvert.SerializeObject(data.Apprentices, TestHelper.DefaultSerialiserSettings)) .WithStatusCode(HttpStatusCode.OK)); AddClaim(EmployerClaimTypes.Account, data.HashedAccountId); return(this); }
public async Task WhenTheEmployerDoesNotSelectAnEligibleApprenticeshipsoption() { var hashedAccountId = _testDataStore.Get <string>("HashedAccountId"); var hashedAccountLegalEntityId = _testDataStore.Get <string>("HashedAccountLegalEntityId"); var testdata = new TestData.Account.WithSingleLegalEntityWithEligibleApprenticeships(); var request = new HttpRequestMessage( HttpMethod.Post, $"{hashedAccountId}/apply/{hashedAccountLegalEntityId}/eligible-apprentices") { Content = new FormUrlEncodedContent(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("OrganisationName", testdata.LegalEntities.First().LegalEntityName) }) }; var response = await _testContext.WebsiteClient.SendAsync(request); response.EnsureSuccessStatusCode(); _testContext.TestDataStore.GetOrCreate("Response", onCreate: () => { return(response); }); }
private void GivenAnEmployerWithALaterAgreementVersionThatIs(bool isSigned) { var testdata = new TestData.Account.WithSingleLegalEntityWithEligibleApprenticeships(); _testDataStore.Add("HashedAccountId", testdata.HashedAccountId); _testContext.AddOrReplaceClaim(EmployerClaimTypes.Account, testdata.HashedAccountId); _testDataStore.Add("HashedAccountLegalEntityId", testdata.HashedAccountLegalEntityId); _testContext.EmployerIncentivesApi.MockServer .Given( Request .Create() .WithPath($"/accounts/{testdata.AccountId}/legalentities") .UsingGet() ) .RespondWith( Response.Create() .WithStatusCode(HttpStatusCode.OK) .WithBody(JsonConvert.SerializeObject(testdata.LegalEntities, TestHelper.DefaultSerialiserSettings))); _testContext.EmployerIncentivesApi.MockServer .Given( Request .Create() .WithPath($"/apprenticeships") .WithParam("accountid", testdata.AccountId.ToString()) .WithParam("accountlegalentityid", testdata.LegalEntities.First().AccountLegalEntityId.ToString()) .UsingGet() ) .RespondWith( Response.Create() .WithBody(JsonConvert.SerializeObject(testdata.Apprentices, TestHelper.DefaultSerialiserSettings)) .WithStatusCode(HttpStatusCode.OK)); _testContext.EmployerIncentivesApi.MockServer .Given( Request .Create() .WithPath($"/accounts/{testdata.AccountId}/legalentities/{testdata.LegalEntities.First().AccountLegalEntityId}") .UsingGet() ) .RespondWith( Response.Create() .WithBody(JsonConvert.SerializeObject(testdata.LegalEntities.First())) .WithStatusCode(HttpStatusCode.OK)); var applications = new List <ApprenticeApplicationModel> { new ApprenticeApplicationModel { AccountId = testdata.AccountId, ApplicationDate = new DateTime(2020, 09, 01), FirstName = "Jane", LastName = "Doe", TotalIncentiveAmount = 1500m, LegalEntityName = $"Organisation {testdata.LegalEntities.First().AccountLegalEntityId}", ULN = 900004567, CourseName = "Accounting", FirstPaymentStatus = new PaymentStatusModel { RequiresNewEmployerAgreement = isSigned } } }; var getApplications = new GetApplicationsModel { ApprenticeApplications = applications, FirstSubmittedApplicationId = Guid.NewGuid() }; _testContext.EmployerIncentivesApi.MockServer .Given( Request .Create() .WithPath($"/accounts/{testdata.AccountId}/legalentity/{testdata.LegalEntities.First().AccountLegalEntityId}/applications") .UsingGet() ) .RespondWith( Response.Create() .WithStatusCode(HttpStatusCode.OK) .WithBody(JsonConvert.SerializeObject(getApplications))); }