コード例 #1
0
 public void ToCurrencyTest()
 {
     CurrencyFormatter cf = new CurrencyFormatter();
     decimal amount=12345.6789M;
     string code="CLP",expected = code+" 12.345,679",actual = "";
     actual = cf.ToCurrency(amount, code);
     Assert.AreEqual(expected, actual);
 }
コード例 #2
0
 public void GetNumberFormatInfoByCurrencySymbolTest()
 {
     CurrencyFormatter cf = new CurrencyFormatter();
     string code="CLP";
     NumberFormatInfo expected = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
         .Where(x => new RegionInfo(x.LCID).ISOCurrencySymbol == code.ToUpper()).FirstOrDefault().NumberFormat;
     expected.CurrencySymbol = code;
     NumberFormatInfo actual = cf.GetNumberFormatInfoByCurrencySymbol(code);
     Assert.AreEqual(expected.CurrencySymbol, actual.CurrencySymbol);
 }