internal override NumberFormat CreateInstance(UCultureInfo desiredLocale, NumberFormatStyle choice) { // use service cache // if (service.isDefault()) { // return NumberFormat.createInstance(desiredLocale, choice); // } NumberFormat fmt = (NumberFormat)service.Get(desiredLocale, (int)choice, out UCultureInfo actualLoc); if (fmt == null) { throw new MissingManifestResourceException("Unable to construct NumberFormat"); } fmt = (NumberFormat)fmt.Clone(); // ICU4N TODO: Currency //// If we are creating a currency type formatter, then we may have to set the currency //// explicitly, since the actualLoc may be different than the desiredLocale //if (choice == NumberFormat.CURRENCYSTYLE || // choice == NumberFormat.ISOCURRENCYSTYLE || // choice == NumberFormat.PLURALCURRENCYSTYLE) //{ // fmt.SetCurrency(Currency.GetInstance(desiredLocale)); //} UCultureInfo uloc = actualLoc; fmt.SetCulture(uloc, uloc); // services make no distinction between actual & valid return(fmt); }
public void NumerFormatStyle_ImplicitOperator_EmptyStringParam_ReturnsNull() { // Arrange // Act NumberFormatStyle style = string.Empty; // Assert Assert.IsNull(style); }
public void NumberFormatStyle_CreateNew() { // Arrange // Act var style = new NumberFormatStyle(); // Assert Assert.IsNotNull(style); }
public void NumerFormatStyle_ImplicitOperator_NullFormatParam() { // Arrange // Act NumberFormatStyle style = null; string format = style; // Assert Assert.AreEqual(string.Empty, format); }
public void NumberFormatStyle_OuterXml_EmptyNode() { // Arrange var style = new NumberFormatStyle(); // Act var xml = style.OuterXml; // Assert Assert.IsNotNull(xml); Assert.AreEqual(string.Empty, xml); }
public void NumberFormatStyle_GetSet_Properties() { // Arrange var format = "format"; var style = new NumberFormatStyle(); // Act style.Format = format; // Assert Assert.AreEqual(format, style.Format); }
public void NumberFormatStyle_OuterXml() { // Arrange var format = "format"; var style = new NumberFormatStyle(); style.Format = format; // Act var xml = style.OuterXml; // Assert Assert.IsNotNull(xml); }