public void FormatUsingDefaults() { PercentFormatter fmt = new PercentFormatter("en-US"); Assert.AreEqual("25.00 %", fmt.Format(0.25)); Assert.AreEqual("25.34 %", fmt.Format(0.2534)); fmt = new PercentFormatter("sr-SP-Latn"); Assert.AreEqual("25,00%", fmt.Format(0.25)); Assert.AreEqual("25,34%", fmt.Format(0.2534)); }
public void FormatUsingCustomSettings() { PercentFormatter fmt = new PercentFormatter("en-US"); fmt.DecimalDigits = 0; fmt.PositivePattern = 1; Assert.AreEqual("25%", fmt.Format(0.25)); Assert.AreEqual("25%", fmt.Format(0.2534)); fmt = new PercentFormatter("sr-SP-Latn"); fmt.DecimalDigits = 1; Assert.AreEqual("25,0%", fmt.Format(0.25)); Assert.AreEqual("25,3%", fmt.Format(0.2534)); }
public void FormatNonNumber() { PercentFormatter fmt = new PercentFormatter(); fmt.Format("not a number"); }
public void FormatNullValue() { PercentFormatter fmt = new PercentFormatter(); fmt.Format(null); }
public void FormatNonNumber() { PercentFormatter fmt = new PercentFormatter(); Assert.Throws<ArgumentException>(() => fmt.Format("not a number")); }
public void FormatNullValue() { PercentFormatter fmt = new PercentFormatter(); Assert.Throws<ArgumentNullException>(() => fmt.Format(null)); }
public void FormatNonNumber() { PercentFormatter fmt = new PercentFormatter(); Assert.Throws <ArgumentException>(() => fmt.Format("not a number")); }
public void FormatNullValue() { PercentFormatter fmt = new PercentFormatter(); Assert.Throws <ArgumentNullException>(() => fmt.Format(null)); }