@@ -14,10 +14,8 @@ public void Can_Convert_DateTimeOffsets()
1414 var dto = new DateTimeOffset ( new DateTime ( 2002 , 2 , 2 ) , TimeSpan . FromHours ( 4 ) ) ;
1515 string formattedString = dto . ToString ( "O" ) ;
1616
17- var typeConverter = new RuntimeTypeConverter ( ) ;
18-
1917 // Act
20- object result = typeConverter . ConvertType ( formattedString , typeof ( DateTimeOffset ) ) ;
18+ object result = RuntimeTypeConverter . ConvertType ( formattedString , typeof ( DateTimeOffset ) ) ;
2119
2220 // Assert
2321 Assert . Equal ( dto , result ) ;
@@ -29,10 +27,8 @@ public void Bad_DateTimeOffset_String_Throws()
2927 // Arrange
3028 const string formattedString = "this_is_not_a_valid_dto" ;
3129
32- var typeConverter = new RuntimeTypeConverter ( ) ;
33-
3430 // Act
35- Action action = ( ) => typeConverter . ConvertType ( formattedString , typeof ( DateTimeOffset ) ) ;
31+ Action action = ( ) => RuntimeTypeConverter . ConvertType ( formattedString , typeof ( DateTimeOffset ) ) ;
3632
3733 // Assert
3834 Assert . Throws < FormatException > ( action ) ;
@@ -44,10 +40,8 @@ public void Can_Convert_Enums()
4440 // Arrange
4541 const string formattedString = "1" ;
4642
47- var typeConverter = new RuntimeTypeConverter ( ) ;
48-
4943 // Act
50- object result = typeConverter . ConvertType ( formattedString , typeof ( TestEnum ) ) ;
44+ object result = RuntimeTypeConverter . ConvertType ( formattedString , typeof ( TestEnum ) ) ;
5145
5246 // Assert
5347 Assert . Equal ( TestEnum . Test , result ) ;
@@ -60,10 +54,8 @@ public void ConvertType_Returns_Value_If_Type_Is_Same()
6054 var val = new ComplexType ( ) ;
6155 Type type = val . GetType ( ) ;
6256
63- var typeConverter = new RuntimeTypeConverter ( ) ;
64-
6557 // Act
66- object result = typeConverter . ConvertType ( val , type ) ;
58+ object result = RuntimeTypeConverter . ConvertType ( val , type ) ;
6759
6860 // Assert
6961 Assert . Equal ( val , result ) ;
@@ -78,11 +70,9 @@ public void ConvertType_Returns_Value_If_Type_Is_Assignable()
7870 Type baseType = typeof ( BaseType ) ;
7971 Type iType = typeof ( IType ) ;
8072
81- var typeConverter = new RuntimeTypeConverter ( ) ;
82-
8373 // Act
84- object baseResult = typeConverter . ConvertType ( val , baseType ) ;
85- object iResult = typeConverter . ConvertType ( val , iType ) ;
74+ object baseResult = RuntimeTypeConverter . ConvertType ( val , baseType ) ;
75+ object iResult = RuntimeTypeConverter . ConvertType ( val , iType ) ;
8676
8777 // Assert
8878 Assert . Equal ( val , baseResult ) ;
@@ -102,12 +92,10 @@ public void ConvertType_Returns_Default_Value_For_Empty_Strings()
10292 { typeof ( Guid ) , Guid . Empty }
10393 } ;
10494
105- var typeConverter = new RuntimeTypeConverter ( ) ;
106-
10795 foreach ( KeyValuePair < Type , object > pair in data )
10896 {
10997 // Act
110- object result = typeConverter . ConvertType ( string . Empty , pair . Key ) ;
98+ object result = RuntimeTypeConverter . ConvertType ( string . Empty , pair . Key ) ;
11199
112100 // Assert
113101 Assert . Equal ( pair . Value , result ) ;
@@ -121,10 +109,8 @@ public void Can_Convert_TimeSpans()
121109 TimeSpan timeSpan = TimeSpan . FromMinutes ( 45 ) ;
122110 string stringSpan = timeSpan . ToString ( ) ;
123111
124- var typeConverter = new RuntimeTypeConverter ( ) ;
125-
126112 // Act
127- object result = typeConverter . ConvertType ( stringSpan , typeof ( TimeSpan ) ) ;
113+ object result = RuntimeTypeConverter . ConvertType ( stringSpan , typeof ( TimeSpan ) ) ;
128114
129115 // Assert
130116 Assert . Equal ( timeSpan , result ) ;
@@ -136,10 +122,8 @@ public void Bad_TimeSpanString_Throws()
136122 // Arrange
137123 const string formattedString = "this_is_not_a_valid_timespan" ;
138124
139- var typeConverter = new RuntimeTypeConverter ( ) ;
140-
141125 // Act
142- Action action = ( ) => typeConverter . ConvertType ( formattedString , typeof ( TimeSpan ) ) ;
126+ Action action = ( ) => RuntimeTypeConverter . ConvertType ( formattedString , typeof ( TimeSpan ) ) ;
143127
144128 // Assert
145129 Assert . Throws < FormatException > ( action ) ;
0 commit comments