/// <summary> /// Determina se un indirizzo di rete ha i requisiti per essere valido in base alla sua tipologia /// </summary> /// <param name="address">Indirizzo di rete da verificare</param> /// <param name="type">Tipologia di indirizzo di rete</param> /// <param name="structure">Struttura dell'indirizzo di rete</param> /// <returns></returns> public static bool IsValidAddress(string address, AddressType type, AddressStructure structure) { if (type == AddressType.NetworkAddress) { if (structure == AddressStructure.IntegerAddress) { return(_IsValidAddressInt(address)); } else { return(_IsValidAddressBin(address)); } } else { if (structure == AddressStructure.IntegerAddress) { return(_IsValidSubnetmaskInt(address)); } else { return(_IsValidSubnetmaskBin(address)); } } }
private bool AreSame(AddressStructure current, AddressStructure staging) { if (current?.Address1 != staging?.Address1 || current?.Address2 != staging?.Address2 || current?.Address3 != staging?.Address3 || current?.Address4 != staging?.Address4 || current?.Town != staging?.Town || current?.County != staging?.County || current?.PostCode != staging?.PostCode) { return(false); } return(true); }
public async Task ThenItShouldMapProviderToLearningProvider(Provider source, AddressStructure address, string websiteAddress, long urn, string dfeNumber, string charityNumber, string companyNumber) { source.Verifications = new[] { new VerificationDetails { Authority = "DfE (Schools Unique Reference Number)", Id = urn.ToString() }, new VerificationDetails { Authority = "DfE (LEA Code and Establishment Number)", Id = dfeNumber }, new VerificationDetails { Authority = "Charity Commission", Id = charityNumber }, new VerificationDetails { Authority = "Companies House", Id = companyNumber }, }; source.ProviderContacts = new[] { new ProviderContact { ContactType = "L", ContactAddress = address, }, new ProviderContact { ContactType = "P", ContactWebsiteAddress = websiteAddress, }, }; var actual = await _mapper.MapAsync <LearningProvider>(source, _cancellationToken) as LearningProvider; Assert.IsNotNull(actual); Assert.AreEqual(source.ProviderName, actual.Name); Assert.AreEqual(source.UnitedKingdomProviderReferenceNumber, actual.Ukprn); Assert.AreEqual(address.PostCode, actual.Postcode); Assert.AreEqual(source.ProviderName, actual.LegalName); Assert.AreEqual(urn, actual.Urn); Assert.AreEqual(dfeNumber, actual.DfeNumber); Assert.AreEqual(companyNumber, actual.CompaniesHouseNumber); Assert.AreEqual(charityNumber, actual.CharitiesCommissionNumber); Assert.AreEqual(websiteAddress, actual.Website); }