示例#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("");
        }
示例#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);
        }
示例#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);
        }
示例#4
0
        public void alpha2Test()
        {
            var a = new Alpha2();

            Assert.AreEqual(0, a.alpha2("a"));
            Assert.AreEqual(1, a.alpha2("b"));
            Assert.AreEqual(2, a.alpha2("abc"));
            Assert.AreEqual(2, a.alpha2("bc"));
            Assert.AreEqual(6, a.alpha2("qwerty"));
            Assert.AreEqual(166, a.alpha2("codefights"));
            Assert.AreEqual(2, a.alpha2("google"));
            Assert.AreEqual(0, a.alpha2(""));
        }
示例#5
0
 public override int GetHashCode()
 {
     return(Alpha2.GetHashCode() + Alpha3.GetHashCode() + CountryName.GetHashCode());
 }
示例#6
0
 public override int GetHashCode() => Alpha2.GetHashCode() + Alpha3.GetHashCode() + CountryName.GetHashCode();
示例#7
0
 public override int GetHashCode() => Alpha2.GetHashCode() + Alpha3.GetHashCode() + CountryName.GetHashCode()
 + IsSEPAMember.GetHashCode() + IsUsingEuros.GetHashCode();