public void Test_clone()
        {
            DateFormat format = DateFormat.GetInstance();
            DateFormat clone  = (DateFormat)format.Clone();

            NUnit.Framework.Assert.IsTrue(format.Equals(clone), "Clone not equal");
            clone.GetNumberFormat().SetMinimumFractionDigits(123);
            NUnit.Framework.Assert.IsTrue(!format.Equals(clone), "Clone shares NumberFormat");
        }
 public override bool Equals(object obj)
 {
     if (obj is DateFormatPattern)
     {
         return(GetHashCode() == obj.GetHashCode());
     }
     if (obj is string)
     {
         return(DateFormat.Equals(obj));
     }
     return(false);
 }
        public void TestDateFormat()
        {
            ULocale defLoc = IBM.ICU.Util.ULocale.GetDefault();

            IBM.ICU.Util.ULocale.SetDefault(_DEFAULT_LOCALE);
            for (int i = 0; i < _LOCALE_NUMBER; i++)
            {
                ULocale oldLoc = _LOCALES[i][0];
                ULocale newLoc = _LOCALES[i][1];
                if (ILOG.J2CsMapping.Collections.Collections.Get(availableMap, _LOCALES[i][1]) == null)
                {
                    Logln(_LOCALES[i][1] + " is not available. Skipping!");
                    continue;
                }
                DateFormat df1 = IBM.ICU.Text.DateFormat
                                 .GetDateInstance(IBM.ICU.Text.DateFormat.FULL, oldLoc);
                DateFormat df2 = IBM.ICU.Text.DateFormat
                                 .GetDateInstance(IBM.ICU.Text.DateFormat.FULL, newLoc);

                // Test function "getLocale"
                ULocale l1 = df1.GetLocale(IBM.ICU.Util.ULocale.VALID_LOCALE);
                ULocale l2 = df2.GetLocale(IBM.ICU.Util.ULocale.VALID_LOCALE);
                if (!newLoc.Equals(l1))
                {
                    Errln("DateFormatTest: newLoc!=l1: newLoc= " + newLoc + " l1= "
                          + l1);
                }
                if (!l1.Equals(l2))
                {
                    Errln("DateFormatTest: l1!=l2: l1= " + l1 + " l2= " + l2);
                }
                if (!df1.Equals(df2))
                {
                    Errln("DateFormatTest: df1!=df2: newLoc= " + newLoc
                          + " oldLoc= " + oldLoc);
                }
                this.Logln("DateFormat(getLocale) old:" + l1 + "   new:" + l2);

                // Test function "format"
                // Date d = new Date();
                // String d1 = df1.format(d);
                // String d2 = df2.format(d);
                // if (!d1.equals(d2)) {
                // pass = false;
                // }
                // this.logln("DateFormat(format) old:"+d1+"   new:"+d2);
            }
            IBM.ICU.Util.ULocale.SetDefault(defLoc);
        }