Ejemplo n.º 1
0
 public void Test_equalsLjava_lang_Object()
 {
     // Test for method boolean
     // java.text.IBM.ICU.Text.MessageFormat.equals(java.lang.Object)
     IBM.ICU.Text.MessageFormat format1_0 = new IBM.ICU.Text.MessageFormat("{0}");
     IBM.ICU.Text.MessageFormat format2_1 = new IBM.ICU.Text.MessageFormat("{1}");
     NUnit.Framework.Assert.IsTrue(!format1_0.Equals(format2_1), "Should not be equal");
     format2_1.ApplyPattern("{0}");
     NUnit.Framework.Assert.IsTrue(format1_0.Equals(format2_1), "Should be equal");
     IBM.ICU.Text.SimpleDateFormat date = (IBM.ICU.Text.SimpleDateFormat)IBM.ICU.Text.DateFormat.GetTimeInstance();
     format1_0.SetFormat(0, IBM.ICU.Text.DateFormat.GetTimeInstance());
     format2_1.SetFormat(0, new IBM.ICU.Text.SimpleDateFormat(date.ToPattern()));
     NUnit.Framework.Assert.IsTrue(format1_0.Equals(format2_1), "Should be equal2");
 }
Ejemplo n.º 2
0
 public void Test_clone()
 {
     // Test for method java.lang.Object java.text.IBM.ICU.Text.MessageFormat.clone()
     IBM.ICU.Text.MessageFormat format = new IBM.ICU.Text.MessageFormat("'{'choice'}'{0}");
     IBM.ICU.Text.MessageFormat clone  = (IBM.ICU.Text.MessageFormat)format.Clone();
     NUnit.Framework.Assert.IsTrue(format.Equals(clone), "Clone not equal");
     NUnit.Framework.Assert.AreEqual("{choice}{0}", format.FormatObject(new Object[] { }), "Wrong answer");
     clone.SetFormat(0, IBM.ICU.Text.DateFormat.GetInstance());
     NUnit.Framework.Assert.IsTrue(!format.Equals(clone), "Clone shares format data");
     format = (IBM.ICU.Text.MessageFormat)clone.Clone();
     Format[] formats = clone.GetFormats();
     ((IBM.ICU.Text.SimpleDateFormat)formats[0]).ApplyPattern("adk123");
     NUnit.Framework.Assert.IsTrue(!format.Equals(clone), "Clone shares format data");
 }