예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }