public async Task Learner_name_is_shown()
        {
            Testing.CommitmentsApi
            .GetApprenticeships(Arg.Is <GetApprenticeshipsRequest>(
                                    req =>
                                    req.AccountId == apprenticeship.AccountId &&
                                    req.SearchTerm == apprenticeship.Uln.ToString()))
            .Returns(Task.FromResult(new GetApprenticeshipsResponse
            {
                Apprenticeships = new[]
                {
                    new GetApprenticeshipsResponse.ApprenticeshipDetailsResponse
                    {
                        FirstName = "LearnerFirstname",
                        LastName  = "LearnerLastname",
                    }
                }
            }));

            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.LearnerName.Should().Be("LearnerFirstname LearnerLastname");
        }
        public async Task Finds_collection_period_data()
        {
            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.CurrentYearDataLocks.Should().ContainEquivalentOf(
                new
            {
                Apprenticeship = new
                {
                    Ukprn            = 10003678,
                    Standard         = 50,
                    Framework        = 0,
                    Program          = 25,
                    Pathway          = 0,
                    Cost             = 25972.0,
                    PriceStart       = new DateTime(2019, 12, 01),
                    CompletionStatus = Domain.ApprenticeshipStatus.Active,
                },
                Ilr = new
                {
                    Ukprn      = 10003678,
                    Standard   = 50,
                    Framework  = 0,
                    Program    = 25,
                    Pathway    = 0,
                    Cost       = 25972.0,
                    PriceStart = new DateTime(2019, 12, 01),
                    //CompletionStatus = Domain.ApprenticeshipStatus.Active,
                }
            });
        }
        public void Correct_academic_years_are_populated()
        {
            Testing.TimeProvider.Today.Returns(new DateTime(2011, 8, 1));
            var learner = Testing.CreatePage <LearnerModel>();

            learner.AcademicYears.Current.Should().Be((AcademicYear)1112);
            learner.AcademicYears.Previous.Should().Be((AcademicYear)1011);
        }
        public async Task Data_locks_are_shown()
        {
            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.DataLockNames.Should().Contain("Dlock01");
        }
Esempio n. 5
0
        public async Task History_only_contains_active_provider()
        {
            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = "3123456789";
            await learner.OnGetAsync();

            learner.CurrentYearDataLocks.Should().NotBeEmpty();
        }
        public async Task Has_data_locks_should_be_false()
        {
            Testing.TimeProvider.Today.Returns(new DateTime(2011, 8, 1));
            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.HasDataLocks.Should().BeFalse();
        }
        public async Task History_only_contains_active_provider()
        {
            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.CurrentYearDataLocks.Should()
            .OnlyContain(x => x.Apprenticeship.Ukprn == 10003678);
        }
        public async Task Searching_for_apprenticeship_finds_multiple_providers()
        {
            Testing.TimeProvider.Today.Returns(new DateTime(2019, 08, 01));

            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.HasMultipleProviders.Should().BeTrue();
        }
        public async Task Populate_datalocks_in_right_academic_year_collection(int year, bool expectedHasDataInCurrentYear, bool expectedHasDataInPreviousYear)
        {
            Testing.TimeProvider.Today.Returns(new DateTime(year, 8, 1));
            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.HasDataLocks.Should().BeTrue();
            learner.HasDataLocksInCurrentYear.Should().Be(expectedHasDataInCurrentYear);
            learner.HasDataLocksInPreviousYear.Should().Be(expectedHasDataInPreviousYear);
        }
        public async Task Active_apprenticeship_with_single_pause_record_gets_pause_dates()
        {
            await Arrange("SFA.DAS.IdentifyDataLocks.IntegrationTests.TestData.ApprenticeshipsWithPausedDates.Active_Apprenticeship_With_Single_Pause_Record.json");

            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.CurrentYearDataLocks.First().Apprenticeship.PausedOn.Should().Be(new DateTime(2019, 1, 1));
            learner.CurrentYearDataLocks.First().Apprenticeship.ResumedOn.Should().Be(new DateTime(2019, 3, 1));
            learner.CurrentYearDataLocks.First().Apprenticeship.CompletionStatus.Should().Be(ApprenticeshipStatus.Active);
        }
        public async Task Paused_apprenticeship_gets_latest_pause_dates()
        {
            await Arrange("SFA.DAS.IdentifyDataLocks.IntegrationTests.TestData.ApprenticeshipsWithPausedDates.Paused_Apprenticeship.json", true);

            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.CurrentYearDataLocks.First().Apprenticeship.PausedOn.Should().Be(new DateTime(2018, 6, 7));
            learner.CurrentYearDataLocks.First().Apprenticeship.ResumedOn.Should().BeNull();
            learner.CurrentYearDataLocks.First().Apprenticeship.CompletionStatus.Should().Be(ApprenticeshipStatus.Paused);
        }
        public async Task Account_details_are_shown()
        {
            Testing.AccountsApi
            .GetAccount(apprenticeship.AccountId)
            .Returns(Task.FromResult(new AccountDetailViewModel
            {
                DasAccountName        = "Fantastic Employer",
                PublicHashedAccountId = "qwerty",
            }));

            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.EmployerId.Should().Be("qwerty");
            learner.EmployerName.Should().Be("Fantastic Employer");
        }
        public async Task Provider_details_are_shown()
        {
            Testing.RoatpApi
            .GetProvider(apprenticeship.Ukprn)
            .Returns(new Provider
            {
                Ukprn = (int)apprenticeship.Ukprn,
                Name  = "Best Training Provider",
            });

            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.ProviderId.Should().Be(apprenticeship.Ukprn.ToString());
            learner.ProviderName.Should().Be("Best Training Provider");
        }
Esempio n. 14
0
        public async Task Searching_for_apprenticeship_UKPRN_finds_dlocks()
        {
            Testing.TimeProvider.Today.Returns(new DateTime(2020, 08, 01));

            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.CurrentYearDataLocks.Should()
            .ContainEquivalentOf(new
            {
                Ilr = new
                {
                    Ukprn = 10018916,
                    Cost  = 3000,
                },
            });
        }
        public async Task History_is_ordered()
        {
            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.CurrentYearDataLocks.Should()
            .NotBeEmpty()
            .And.BeInDescendingOrder()
            .And.BeEquivalentTo(
                new { Period = new Period(1920, 12) },
                new { Period = new Period(1920, 11) },
                new { Period = new Period(1920, 10) },
                new { Period = new Period(1920, 9) },
                new { Period = new Period(1920, 8) },
                new { Period = new Period(1920, 7) },
                new { Period = new Period(1920, 6) },
                new { Period = new Period(1920, 5) }
                );
        }