コード例 #1
0
 public void TestGetInstance_CultureInfo()
 {
     NodaFormatInfo.ClearCache();
     using (CultureSaver.SetCultures(enUs, FailingCultureInfo.Instance))
     {
         var actual = NodaFormatInfo.GetInstance(enGb);
         Assert.AreSame(enGb, actual.CultureInfo);
     }
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
        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);
        }
コード例 #6
0
 public void TestGetFormatInfo_null()
 {
     NodaFormatInfo.ClearCache();
     Assert.Throws <ArgumentNullException>(() => NodaFormatInfo.GetFormatInfo(null));
 }
コード例 #7
0
 public void TestGetInstance_UnusableType()
 {
     NodaFormatInfo.ClearCache();
     Assert.Throws <ArgumentException>(() => NodaFormatInfo.GetInstance(CultureInfo.InvariantCulture.NumberFormat));
 }