Skip to content

Commit 825014f

Browse files
author
Jeremy Tammik
committed
implemented display unit type abbreviation command CmdDutAbbreviation to test the display unit type abbreviation array
1 parent 3efb245 commit 825014f

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

BuildingCoder/BuildingCoder/CmdDutAbbreviation.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ namespace BuildingCoder
2121
[Transaction( TransactionMode.ReadOnly )]
2222
class CmdDutAbbreviation : IExternalCommand
2323
{
24-
const string _s = "unexpected display unit type enumeration sequence";
24+
const string _s = "unexpected display unit type "
25+
+ "enumeration sequence";
2526

2627
public Result Execute(
2728
ExternalCommandData commandData,
2829
ref string message,
2930
ElementSet elements )
3031
{
32+
#region Assertions
3133
Debug.Assert( 0 == (int) DisplayUnitType.DUT_METERS, _s );
3234
Debug.Assert( 1 == (int) DisplayUnitType.DUT_CENTIMETERS, _s );
3335
Debug.Assert( 2 == (int) DisplayUnitType.DUT_MILLIMETERS, _s );
@@ -55,14 +57,15 @@ public Result Execute(
5557
Debug.Assert( 24 == (int) DisplayUnitType.DUT_CUBIC_CENTIMETERS, _s );
5658
Debug.Assert( 25 == (int) DisplayUnitType.DUT_CUBIC_MILLIMETERS, _s );
5759
Debug.Assert( 26 == (int) DisplayUnitType.DUT_LITERS, _s );
60+
#endregion // Assertions
5861

59-
DisplayUnitType n
62+
DisplayUnitType n
6063
= DisplayUnitType.DUT_GALLONS_US;
6164

6265
Debug.Print( "Here is a list of the first {0} "
6366
+ "display unit types with The Building Coder "
6467
+ "abbreviation and the valid unit symbols:\n",
65-
(int) n );
68+
(int) n - 1 );
6669

6770
string valid_unit_symbols;
6871

@@ -74,8 +77,8 @@ DisplayUnitType n
7477
.Select<UnitSymbolType, string>(
7578
u => Util.UnitSymbolTypeString( u ) ) );
7679

77-
Debug.Print( "{0,6} - {1}: {2}",
78-
Util.DisplayUnitTypeAbbreviation[(int)i],
80+
Debug.Print( "{0,6} - {1}: {2}",
81+
Util.DisplayUnitTypeAbbreviation[(int) i],
7982
LabelUtils.GetLabelFor( i ),
8083
//UnitFormatUtils.Format( UnitType. ???
8184
//UnitUtils.ConvertFromInternalUnits( 1, i ),

BuildingCoder/BuildingCoder/Util.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,8 @@ public static string UnitSymbolTypeString(
548548
string s = u.ToString();
549549

550550
Debug.Assert( s.StartsWith( "UST_" ),
551-
"expected UnitSymbolType enumeration value to beging with UST_" );
551+
"expected UnitSymbolType enumeration value "
552+
+ "to begin with 'UST_'" );
552553

553554
s = s.Substring( 4 )
554555
.Replace( "_SUP_", "^" )

0 commit comments

Comments
 (0)