public void Arrange()
        {
            base.Arrange(
                addEpaoClaim: true,
                addUkprnClaim: false,
                contactsPrivileges: new List <ContactsPrivilege>
            {
                // the contact has the explict 'Change Organisation Details' privilege
                ChangeOrganisationDetailsContactsPrivilege
            });

            ContactsApiClient.Setup(c => c.GetAllContactsForOrganisation(EpaoId, null))
            .ReturnsAsync(new List <ContactResponse>());

            ContactsApiClient.Setup(c => c.GetByUsername(ValidPrimaryContact))
            .ReturnsAsync(new ContactResponse
            {
                Id             = Guid.NewGuid(),
                OrganisationId = OrganisationOneId,
                Username       = ValidPrimaryContact
            });

            ContactsApiClient.Setup(c => c.GetByUsername(ValidPrimaryContactSameOrganisation))
            .ReturnsAsync(new ContactResponse
            {
                Id             = ValidPrimaryContactIdSameOrganisation,
                OrganisationId = OrganisationOneId,
                Username       = ValidPrimaryContactSameOrganisation
            });

            OrganisationApiClient.Setup(c => c.UpdateEpaOrganisationPrimaryContact(It.IsAny <UpdateEpaOrganisationPrimaryContactRequest>()))
            .ReturnsAsync(new List <ContactResponse>());
        }
        public async Task Should_update_phone_number()
        {
            _actionResult = await Act();

            OrganisationApiClient.Verify(c => c.UpdateEpaOrganisationPhoneNumber(
                                             It.Is <UpdateEpaOrganisationPhoneNumberRequest>(p => p.OrganisationId == EpaoId && p.PhoneNumber == ValidPhoneNumberDifferent)),
                                         Times.Once);
        }
예제 #3
0
        public async Task Should_update_email_address()
        {
            _actionResult = await Act();

            OrganisationApiClient.Verify(c => c.UpdateEpaOrganisationEmail(
                                             It.Is <UpdateEpaOrganisationEmailRequest>(p => p.OrganisationId == EpaoId && p.Email == ValidEmailDifferent)),
                                         Times.Once);
        }
        public async Task Should_update_primary_contact()
        {
            _actionResult = await Act();

            OrganisationApiClient.Verify(c => c.UpdateEpaOrganisationPrimaryContact(
                                             It.Is <UpdateEpaOrganisationPrimaryContactRequest>(p => p.OrganisationId == EpaoId && p.PrimaryContactId == ValidPrimaryContactIdSameOrganisation)),
                                         Times.Once);
        }
예제 #5
0
        public async Task Should_update_website_link()
        {
            _actionResult = await Act();

            OrganisationApiClient.Verify(c => c.UpdateEpaOrganisationWebsiteLink(
                                             It.Is <UpdateEpaOrganisationWebsiteLinkRequest>(p => p.OrganisationId == EpaoId && p.WebsiteLink == ValidWebsiteLinkDifferent)),
                                         Times.Once);
        }
        public void Arrange()
        {
            base.Arrange(
                addEpaoClaim: true,
                addUkprnClaim: false,
                contactsPrivileges: null);

            OrganisationApiClient.Setup(c => c.UpdateEpaOrganisationPhoneNumber(It.IsAny <UpdateEpaOrganisationPhoneNumberRequest>()))
            .ReturnsAsync(new List <ContactResponse>());
        }
        public async Task Should_update_address(string addressLine1, string addressLine2, string addressLine3, string addressLine4, string postcode)
        {
            _actionResult = await Act(new ChangeAddressViewModel
            {
                AddressLine1 = addressLine1,
                AddressLine2 = addressLine2,
                AddressLine3 = addressLine3,
                AddressLine4 = addressLine4,
                Postcode     = postcode,
                ActionChoice = ActionChoiceConfirm
            });

            OrganisationApiClient.Verify(c => c.UpdateEpaOrganisationAddress(
                                             It.Is <UpdateEpaOrganisationAddressRequest>(p =>
                                                                                         p.OrganisationId == EpaoId &&
                                                                                         p.AddressLine1 == addressLine1 &&
                                                                                         p.AddressLine2 == addressLine2 &&
                                                                                         p.AddressLine3 == addressLine3 &&
                                                                                         p.AddressLine4 == addressLine4 &&
                                                                                         p.Postcode == postcode)),
                                         Times.Once);
        }
        public async Task Should_get_an_organisation_by_epao()
        {
            _actionResult = await Act();

            OrganisationApiClient.Verify(a => a.GetEpaOrganisation(EpaoId));
        }
        public async Task Should_get_an_organisation_by_ukprn()
        {
            _actionResult = await sut.Index();

            OrganisationApiClient.Verify(a => a.Get("12345"));
        }