File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -305,6 +305,27 @@ public void DecimalPointDigitGroupingCultureFormatting(string culture)
305
305
306
306
#region Significant Digits After Radix Formatting
307
307
308
+ [ Test ]
309
+ public void MapUnitToAbbreviation_AddCustomUnit_DoesNotOverrideDefaultAbbreviationForAlreadyMappedUnits ( )
310
+ {
311
+ CultureInfo cultureInfo = CultureInfo . GetCultureInfo ( "en-US" ) ;
312
+ UnitSystem unitSystem = UnitSystem . GetCached ( cultureInfo ) ;
313
+ unitSystem . MapUnitToAbbreviation ( AreaUnit . SquareMeter , "m^2" ) ;
314
+
315
+ Assert . AreEqual ( "m²" , unitSystem . GetDefaultAbbreviation ( AreaUnit . SquareMeter ) ) ;
316
+ }
317
+
318
+ [ TestCase ( "m^2" , Result = AreaUnit . SquareMeter ) ]
319
+ [ TestCase ( "cm^2" , Result = AreaUnit . Undefined ) ]
320
+ public AreaUnit Parse_ReturnsUnitMappedByCustomAbbreviationOrUndefined ( string unitAbbreviationToParse )
321
+ {
322
+ CultureInfo cultureInfo = CultureInfo . GetCultureInfo ( "en-US" ) ;
323
+ UnitSystem unitSystem = UnitSystem . GetCached ( cultureInfo ) ;
324
+ unitSystem . MapUnitToAbbreviation ( AreaUnit . SquareMeter , "m^2" ) ;
325
+
326
+ return unitSystem . Parse < AreaUnit > ( unitAbbreviationToParse ) ;
327
+ }
328
+
308
329
[ TestCase ( 1 , Result = "1.1 m" ) ]
309
330
[ TestCase ( 2 , Result = "1.12 m" ) ]
310
331
[ TestCase ( 3 , Result = "1.123 m" ) ]
You can’t perform that action at this time.
0 commit comments