1
- // Licensed under MIT No Attribution, see LICENSE file at the root.
1
+ // Licensed under MIT No Attribution, see LICENSE file at the root.
2
2
// Copyright 2013 Andreas Gullberg Larsen ([email protected] ). Maintained at https://github.com/angularsen/UnitsNet.
3
3
4
4
using System ;
@@ -166,7 +166,7 @@ public void ConvertTo_GivenStringType_ReturnsQuantityString()
166
166
}
167
167
168
168
[ Fact ]
169
- public void ConvertTo_GivenSomeQuantitysAndContextWithNoAttributes_ReturnsQuantityStringInUnitOfQuantity ( )
169
+ public void ConvertTo_GivenSomeQuantityAndContextWithNoAttributes_ReturnsQuantityStringInUnitOfQuantity ( )
170
170
{
171
171
var converter = new QuantityTypeConverter < Length > ( ) ;
172
172
ITypeDescriptorContext context = new TypeDescriptorContext ( "SomeMemberName" , new Attribute [ ] { } ) ;
@@ -178,7 +178,19 @@ public void ConvertTo_GivenSomeQuantitysAndContextWithNoAttributes_ReturnsQuanti
178
178
}
179
179
180
180
[ Fact ]
181
- public void ConvertTo_TestDisplayAsFormatting_ReturnsQuantityStringWithDisplayUnitDefaultFormating ( )
181
+ public void ConvertTo_GivenSomeQuantityAndContextWithoutProperty_ReturnsQuantityStringInUnitOfQuantity ( )
182
+ {
183
+ var converter = new QuantityTypeConverter < Length > ( ) ;
184
+ ITypeDescriptorContext context = new TypeDescriptorContext ( ) ;
185
+ Length length = Length . FromMeters ( 1 ) ;
186
+
187
+ string convertedQuantity = ( string ) converter . ConvertTo ( context , culture , length , typeof ( string ) ) ;
188
+
189
+ Assert . Equal ( "1 m" , convertedQuantity ) ;
190
+ }
191
+
192
+ [ Fact ]
193
+ public void ConvertTo_TestDisplayAsFormatting_ReturnsQuantityStringWithDisplayUnitDefaultFormatting ( )
182
194
{
183
195
var converter = new QuantityTypeConverter < Length > ( ) ;
184
196
ITypeDescriptorContext context = new TypeDescriptorContext ( "SomeMemberName" , new Attribute [ ]
@@ -193,7 +205,7 @@ public void ConvertTo_TestDisplayAsFormatting_ReturnsQuantityStringWithDisplayUn
193
205
}
194
206
195
207
[ Fact ]
196
- public void ConvertTo_TestDisplayAsFormatting_ReturnsQuantityStringWithDisplayUnitFormateAsValueOnly ( )
208
+ public void ConvertTo_TestDisplayAsFormatting_ReturnsQuantityStringWithDisplayUnitFormatAsValueOnly ( )
197
209
{
198
210
var converter = new QuantityTypeConverter < Length > ( ) ;
199
211
ITypeDescriptorContext context = new TypeDescriptorContext ( "SomeMemberName" , new Attribute [ ]
@@ -208,7 +220,7 @@ public void ConvertTo_TestDisplayAsFormatting_ReturnsQuantityStringWithDisplayUn
208
220
}
209
221
210
222
[ Fact ]
211
- public void ConvertTo_TestDisplayAsFormattingWithoutDefinedUnit_ReturnsQuantityStringWithQuantetiesUnitAndFormatedAsValueOnly ( )
223
+ public void ConvertTo_TestDisplayAsFormattingWithoutDefinedUnit_ReturnsQuantityStringWithQuantityUnitAndFormattedAsValueOnly ( )
212
224
{
213
225
var converter = new QuantityTypeConverter < Length > ( ) ;
214
226
ITypeDescriptorContext context = new TypeDescriptorContext ( "SomeMemberName" , new Attribute [ ]
@@ -223,7 +235,7 @@ public void ConvertTo_TestDisplayAsFormattingWithoutDefinedUnit_ReturnsQuantityS
223
235
}
224
236
225
237
[ Fact ]
226
- public void ConvertTo_GivenSomeQuantitysAndContextWithDisplayAsUnitAttributes_ReturnsQuantityStringInSpecifiedDisplayUnit ( )
238
+ public void ConvertTo_GivenSomeQuantityAndContextWithDisplayAsUnitAttributes_ReturnsQuantityStringInSpecifiedDisplayUnit ( )
227
239
{
228
240
var converter = new QuantityTypeConverter < Length > ( ) ;
229
241
ITypeDescriptorContext context = new TypeDescriptorContext ( "SomeMemberName" , new Attribute [ ]
0 commit comments