Example #1
0
        public async Task Validate_GivenHasMultipleOfFacilityCheck_FlagsShouldBeValid(bool hasMultipleOfFacility)
        {
            A.CallTo(() => organisationDataAccess.HasMultipleOfEntityFacility(organisationId, A <FacilityType> ._)).Returns(hasMultipleOfFacility);

            var result = await getOrganisationDeletionStatus.Validate(organisationId, ComplianceYear, FacilityType.Aatf);

            if (hasMultipleOfFacility)
            {
                result.Should().HaveFlag(CanOrganisationBeDeletedFlags.HasMultipleOfFacility);
            }
            else
            {
                result.Should().NotHaveFlag(CanOrganisationBeDeletedFlags.HasMultipleOfFacility);
            }
        }
Example #2
0
        public async Task <CanOrganisationBeDeletedFlags> Validate(Guid organisationId, int year, FacilityType facilityType)
        {
            var result = new CanOrganisationBeDeletedFlags();

            if (await organisationDataAccess.HasReturns(organisationId, year))
            {
                result |= CanOrganisationBeDeletedFlags.HasReturns;
            }

            if (await organisationDataAccess.HasActiveUsers(organisationId))
            {
                result |= CanOrganisationBeDeletedFlags.HasActiveUsers;
            }

            if (await organisationDataAccess.HasScheme(organisationId))
            {
                result |= CanOrganisationBeDeletedFlags.HasScheme;
            }

            if (await organisationDataAccess.HasFacility(organisationId, FacilityType.Aatf))
            {
                result |= CanOrganisationBeDeletedFlags.HasAatf;
            }

            if (await organisationDataAccess.HasFacility(organisationId, FacilityType.Ae))
            {
                result |= CanOrganisationBeDeletedFlags.HasAe;
            }

            if (await organisationDataAccess.HasMultipleOfEntityFacility(organisationId, facilityType))
            {
                result |= CanOrganisationBeDeletedFlags.HasMultipleOfFacility;
            }

            return(result);
        }