public async Task Validate_GivenHasSchemeCheck_FlagsShouldBeValid(bool hasScheme) { A.CallTo(() => organisationDataAccess.HasScheme(organisationId)).Returns(hasScheme); var result = await getOrganisationDeletionStatus.Validate(organisationId, ComplianceYear, FacilityType.Aatf); if (hasScheme) { result.Should().HaveFlag(CanOrganisationBeDeletedFlags.HasScheme); } else { result.Should().NotHaveFlag(CanOrganisationBeDeletedFlags.HasScheme); } }
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); }