public async Task Handle_WithAccountIdWithTransferApprovedCohort_ShouldReturnEmptyList() { var f = new GetCohortsHandlerTestFixtures(); f.AddTransferCohortForEmployerAndApprovedByAll(f.AccountId); var response = await f.GetResponse(new GetCohortsQuery(f.AccountId, null)); Assert.IsNotNull(response); Assert.AreEqual(0, response.Cohorts.Length); }
public async Task Handle_WithAccountIdWithNoCohorts_ShouldReturnEmptyList() { var f = new GetCohortsHandlerTestFixtures(); f.AddEmptyDraftCohortWithEmployer(f.AccountId); var response = await f.GetResponse(new GetCohortsQuery(f.NonMatchingId, null)); Assert.IsNotNull(response); Assert.AreEqual(0, response.Cohorts.Length); }
public async Task Handle_WithAccountId_ShouldReturnEmptyMessagesAsNothingSent() { var f = new GetCohortsHandlerTestFixtures(); f.AddEmptyDraftCohortWithEmployer(f.AccountId); var response = await f.GetResponse(new GetCohortsQuery(f.AccountId, null)); Assert.IsNull(response.Cohorts[0].LatestMessageFromEmployer); Assert.IsNull(response.Cohorts[0].LatestMessageFromProvider); }
public async Task Handle_WithProviderIdWithApprovedCohort_ShouldReturnEmptyList() { var f = new GetCohortsHandlerTestFixtures(); f.AddCohortForEmployerApprovedByBoth(f.AccountId); var response = await f.GetResponse(new GetCohortsQuery(null, f.ProviderId)); Assert.IsNotNull(response); Assert.AreEqual(0, response.Cohorts.Length); }
public async Task Handle_WithAccountId_CohortWithTransferSender_ShouldReturnTransferSenderDetails() { var f = new GetCohortsHandlerTestFixtures(); f.AddCohortWithTransferSender(f.AccountId); var response = await f.GetResponse(new GetCohortsQuery(f.AccountId, null)); Assert.IsNotNull(response); Assert.AreEqual(1, response.Cohorts.Length); Assert.AreEqual(f.TransferSenderId, response.Cohorts[0].TransferSenderId); Assert.AreEqual("TransferSender", response.Cohorts[0].TransferSenderName); }
public async Task Handle_WithAccountId_ShouldReturnDraftUnapprovedCohortsForThatEmployer() { var f = new GetCohortsHandlerTestFixtures(); f.AddEmptyDraftCohortWithEmployer(f.AccountId); var response = await f.GetResponse(new GetCohortsQuery(f.AccountId, null)); Assert.IsNotNull(response); Assert.AreEqual(f.SeedCohorts.Count, response.Cohorts.Length); Assert.AreEqual(f.AccountId, response.Cohorts[0].AccountId); Assert.AreEqual(f.SeedCohorts[0].ProviderId, response.Cohorts[0].ProviderId); Assert.AreEqual(f.SeedCohorts[0].Id, response.Cohorts[0].CohortId); Assert.AreEqual(f.SeedCohorts[0].CreatedOn, response.Cohorts[0].CreatedOn); }
public async Task Handle_WithProviderIdWithMixedCohorts_ShouldReturn3CohortsForProviderIdAndExcludeApprovedCohorts() { var f = new GetCohortsHandlerTestFixtures(); f.AddUnapprovedCohortForEmployerWithMessagesAnd2Apprentices(f.AccountId) .AddUnapprovedCohortForEmployerWithMessagesAnd2Apprentices(f.AccountId) .AddUnapprovedCohortForEmployerWithMessagesAnd2Apprentices(f.NonMatchingId) .AddCohortForEmployerApprovedByBoth(f.AccountId); var response = await f.GetResponse(new GetCohortsQuery(f.AccountId, null)); Assert.IsNotNull(response); Assert.AreEqual(2, response.Cohorts.Length); Assert.AreEqual("EmployerLast", response.Cohorts[0].LatestMessageFromEmployer.Text); Assert.AreEqual("ProviderLast", response.Cohorts[0].LatestMessageFromProvider.Text); Assert.AreEqual(2, response.Cohorts[0].NumberOfDraftApprentices); Assert.AreEqual("EmployerLast", response.Cohorts[1].LatestMessageFromEmployer.Text); Assert.AreEqual("ProviderLast", response.Cohorts[1].LatestMessageFromProvider.Text); Assert.AreEqual(2, response.Cohorts[1].NumberOfDraftApprentices); }