public void TestGetInstance_CultureInfo() { NodaFormatInfo.ClearCache(); using (CultureSaver.SetCultures(enUs, FailingCultureInfo.Instance)) { var actual = NodaFormatInfo.GetInstance(enGb); Assert.AreSame(enGb, actual.CultureInfo); } }
public void TestGetInstance_IFormatProvider() { NodaFormatInfo.ClearCache(); using (CultureSaver.SetCultures(enUs, FailingCultureInfo.Instance)) { var provider = new EmptyFormatProvider(); var actual = NodaFormatInfo.GetInstance(provider); Assert.AreSame(enUs, actual.CultureInfo); } }
public void TestGetInstance_DateTimeFormatInfo() { NodaFormatInfo.ClearCache(); using (CultureSaver.SetCultures(enUs, FailingCultureInfo.Instance)) { var info = NodaFormatInfo.GetInstance(enGb.DateTimeFormat); Assert.AreEqual(enGb.DateTimeFormat, info.DateTimeFormat); Assert.AreEqual(CultureInfo.InvariantCulture, info.CultureInfo); } }
public void TestGetInstance_null() { NodaFormatInfo.ClearCache(); using (CultureSaver.SetCultures(enUs, FailingCultureInfo.Instance)) { var info = NodaFormatInfo.GetInstance(null); Assert.AreEqual(Thread.CurrentThread.CurrentCulture, info.CultureInfo); } using (CultureSaver.SetCultures(enGb, FailingCultureInfo.Instance)) { var info = NodaFormatInfo.GetInstance(null); Assert.AreEqual(Thread.CurrentThread.CurrentCulture, info.CultureInfo); } }
public void TestGetFormatInfo() { NodaFormatInfo.ClearCache(); var info1 = NodaFormatInfo.GetFormatInfo(enUs); Assert.NotNull(info1); var info2 = NodaFormatInfo.GetFormatInfo(enUs); Assert.AreSame(info1, info2); var info3 = NodaFormatInfo.GetFormatInfo(enGb); Assert.AreNotSame(info1, info3); }
public void TestGetFormatInfo_null() { NodaFormatInfo.ClearCache(); Assert.Throws <ArgumentNullException>(() => NodaFormatInfo.GetFormatInfo(null)); }
public void TestGetInstance_UnusableType() { NodaFormatInfo.ClearCache(); Assert.Throws <ArgumentException>(() => NodaFormatInfo.GetInstance(CultureInfo.InvariantCulture.NumberFormat)); }