public void Test_getDateInstanceI() { NUnit.Framework.Assert.IsTrue(DateFormat.DEFAULT == DateFormat.MEDIUM, "Default not medium"); SimpleDateFormat f2 = (SimpleDateFormat)DateFormat .GetDateInstance(DateFormat.SHORT); NUnit.Framework.Assert.IsTrue((Object)f2.GetType() == (Object)typeof(SimpleDateFormat), "Wrong class1"); NUnit.Framework.Assert.IsTrue(f2.Equals(DateFormat.GetDateInstance(DateFormat.SHORT, Locale.GetDefault())), "Wrong default1"); NUnit.Framework.Assert.IsTrue(f2.GetDateFormatSymbols().Equals(new DateFormatSymbols()), "Wrong symbols1"); NUnit.Framework.Assert.IsTrue((Object)f2.Format(DateTime.Now).GetType() == (Object)typeof(String), "Doesn't work1"); f2 = (SimpleDateFormat)DateFormat.GetDateInstance(DateFormat.MEDIUM); NUnit.Framework.Assert.IsTrue((Object)f2.GetType() == (Object)typeof(SimpleDateFormat), "Wrong class2"); NUnit.Framework.Assert.IsTrue(f2.Equals(DateFormat.GetDateInstance(DateFormat.MEDIUM, Locale.GetDefault())), "Wrong default2"); NUnit.Framework.Assert.IsTrue(f2.GetDateFormatSymbols().Equals(new DateFormatSymbols()), "Wrong symbols2"); NUnit.Framework.Assert.IsTrue((Object)f2.Format(DateTime.Now).GetType() == (Object)typeof(String), "Doesn't work2"); f2 = (SimpleDateFormat)DateFormat.GetDateInstance(DateFormat.LONG); NUnit.Framework.Assert.IsTrue((Object)f2.GetType() == (Object)typeof(SimpleDateFormat), "Wrong class3"); NUnit.Framework.Assert.IsTrue(f2.Equals(DateFormat.GetDateInstance(DateFormat.LONG, Locale.GetDefault())), "Wrong default3"); NUnit.Framework.Assert.IsTrue(f2.GetDateFormatSymbols().Equals(new DateFormatSymbols()), "Wrong symbols3"); NUnit.Framework.Assert.IsTrue((Object)f2.Format(DateTime.Now).GetType() == (Object)typeof(String), "Doesn't work3"); f2 = (SimpleDateFormat)DateFormat.GetDateInstance(DateFormat.FULL); NUnit.Framework.Assert.IsTrue((Object)f2.GetType() == (Object)typeof(SimpleDateFormat), "Wrong class4"); NUnit.Framework.Assert.IsTrue(f2.Equals(DateFormat.GetDateInstance(DateFormat.FULL, Locale.GetDefault())), "Wrong default4"); NUnit.Framework.Assert.IsTrue(f2.GetDateFormatSymbols().Equals(new DateFormatSymbols()), "Wrong symbols4"); NUnit.Framework.Assert.IsTrue((Object)f2.Format(DateTime.Now).GetType() == (Object)typeof(String), "Doesn't work4"); // regression test for HARMONY-940 try { DateFormat.GetDateInstance(77); NUnit.Framework.Assert.Fail("Should throw IAE"); } catch (ArgumentException iae) { // expected } }
public void Test_getDateInstance() { SimpleDateFormat f2 = (SimpleDateFormat)DateFormat.GetDateInstance(); NUnit.Framework.Assert.IsTrue((Object)f2.GetType() == (Object)typeof(SimpleDateFormat), "Wrong class"); NUnit.Framework.Assert.IsTrue(f2.Equals(DateFormat.GetDateInstance(DateFormat.DEFAULT, Locale.GetDefault())), "Wrong default"); NUnit.Framework.Assert.IsTrue(f2.GetDateFormatSymbols().Equals(new DateFormatSymbols()), "Wrong symbols"); NUnit.Framework.Assert.IsTrue((Object)f2.Format(DateTime.Now).GetType() == (Object)typeof(String), "Doesn't work"); }