예제 #1
0
        public async Task Then_a_warning_message_advising_about_the_signed_legal_agreement_version_is_shown()
        {
            // Arrange
            var legalEntity = new LegalEntityModel
            {
                AccountId               = _accountId,
                AccountLegalEntityId    = _accountLegalEntityId,
                HasSignedIncentiveTerms = true,
                SignedAgreementVersion  = 4,
                Name = "Organisation Name"
            };
            var legalEntities = new List <LegalEntityModel> {
                legalEntity
            };

            _legalEntitiesService.Setup(x => x.Get(_accountId)).ReturnsAsync(legalEntities);

            // Act
            var result = await _sut.Start(_accountId, _accountLegalEntityId);

            // Assert
            var viewResult = result as ViewResult;

            viewResult.Should().NotBeNull();
            var model = viewResult.Model as HomeViewModel;

            model.Should().NotBeNull();
            model.NewAgreementRequired.Should().BeTrue();
            model.OrganisationName.Should().Be(legalEntity.Name);
            model.AccountsAgreementsUrl.Should().Be($"{_externalLinks.ManageApprenticeshipSiteUrl}/accounts/{_accountId}/agreements");
        }
예제 #2
0
        public async Task Then_the_view_model_is_populated_accordingly_if_the_account_has_multiple_legal_entities()
        {
            // Arrange
            var legalEntities = _fixture.CreateMany <LegalEntityModel>(3).ToList();

            legalEntities[0].AccountId            = _accountId;
            legalEntities[0].AccountLegalEntityId = _accountLegalEntityId;
            _legalEntitiesService.Setup(x => x.Get(_accountId)).ReturnsAsync(legalEntities);

            // Act
            var viewResult = await _sut.Start(_accountId, _accountLegalEntityId) as ViewResult;

            // Assert
            viewResult.Should().NotBeNull();
            var model = viewResult.Model as HomeViewModel;

            model.Should().NotBeNull();
            model.AccountId.Should().Be(_accountId);
            model.AccountLegalEntityId.Should().Be(_accountLegalEntityId);
        }