Beispiel #1
0
        public override string ToString()
        {
            if (!string.IsNullOrWhiteSpace(ShortName))
            {
                return(ShortName);
            }

            if (!string.IsNullOrWhiteSpace(ActiveDirectoryName))
            {
                return(ActiveDirectoryName);
            }

            if (!string.IsNullOrWhiteSpace(FullName))
            {
                return(FullName);
            }

            if (!string.IsNullOrWhiteSpace(Alpha2.ToString()))
            {
                return(Alpha2.ToString());
            }

            if (!string.IsNullOrWhiteSpace(Alpha3.ToString()))
            {
                return(Alpha3.ToString());
            }

            if (Numeric != null)
            {
                return(Numeric.GetValueOrDefault().ToString());
            }

            return("");
        }
Beispiel #2
0
        public override bool Equals(object obj)
        {
            if (obj is CountryCodeEntry)
            {
                CountryCodeEntry other = obj as CountryCodeEntry;
                return(Alpha2.Equals(other.Alpha2) & Alpha3.Equals(other.Alpha3) & CountryName.Equals(other.CountryName));
            }

            return(false);
        }
Beispiel #3
0
        public override bool Equals(object obj)
        {
            if (obj is CountryCodeEntry entry)
            {
                return(Alpha2.Equals(entry.Alpha2) & Alpha3.Equals(entry.Alpha3) & CountryName.Equals(entry.CountryName)
                       & IsSEPAMember == entry.IsSEPAMember & IsUsingEuros == entry.IsUsingEuros);
            }

            return(false);
        }
Beispiel #4
0
        public void Alpha3()
        {
            var a = new Alpha3();

            Assert.AreEqual("123", a.alpha3("abc"));
            Assert.AreEqual("124", a.alpha3("abd"));
            Assert.AreEqual("432", a.alpha3("bcd"));
            Assert.AreEqual("345", a.alpha3("cde"));
            Assert.AreEqual("98", a.alpha3("hij"));
            Assert.AreEqual("866", a.alpha3("zfr"));
            Assert.AreEqual("0", a.alpha3("jtj"));
            Assert.AreEqual("7777498096857450", a.alpha3("Longer string!!!"));
        }
Beispiel #5
0
 public override int GetHashCode()
 {
     return(Alpha2.GetHashCode() + Alpha3.GetHashCode() + CountryName.GetHashCode());
 }
Beispiel #6
0
 public override int GetHashCode() => Alpha2.GetHashCode() + Alpha3.GetHashCode() + CountryName.GetHashCode();
Beispiel #7
0
 public override int GetHashCode() => Alpha2.GetHashCode() + Alpha3.GetHashCode() + CountryName.GetHashCode()
 + IsSEPAMember.GetHashCode() + IsUsingEuros.GetHashCode();