@@ -160,29 +160,22 @@ public override int GetHashCode()
160
160
161
161
public static void AssertIsEqual ( ModelWithFieldsOfDifferentTypes actual , ModelWithFieldsOfDifferentTypes expected )
162
162
{
163
- Assert . That ( actual . Id , Is . EqualTo ( expected . Id ) ) ;
164
- Assert . That ( actual . Name , Is . EqualTo ( expected . Name ) ) ;
165
- Assert . That ( actual . Guid , Is . EqualTo ( expected . Guid ) ) ;
166
- Assert . That ( actual . LongId , Is . EqualTo ( expected . LongId ) ) ;
167
- Assert . That ( actual . Bool , Is . EqualTo ( expected . Bool ) ) ;
168
- try
169
- {
170
- Assert . That ( actual . DateTime , Is . EqualTo ( expected . DateTime ) ) ;
171
- }
172
- catch ( Exception ex )
173
- {
174
- Log . Error ( "Trouble with DateTime precisions, trying Assert again with rounding to seconds" , ex ) ;
175
- Assert . That ( actual . DateTime . RoundToSecond ( ) , Is . EqualTo ( expected . DateTime . RoundToSecond ( ) ) ) ;
176
- }
177
- try
178
- {
179
- Assert . That ( actual . Double , Is . EqualTo ( expected . Double ) ) ;
180
- }
181
- catch ( Exception ex )
182
- {
183
- Log . Error ( "Trouble with double precisions, trying Assert again with rounding to 10 decimals" , ex ) ;
184
- Assert . That ( Math . Round ( actual . Double , 10 ) , Is . EqualTo ( Math . Round ( actual . Double , 10 ) ) ) ;
185
- }
163
+ if ( actual . Id != expected . Id )
164
+ throw new Exception ( $ "{ actual . Id } != { expected . Id } ") ;
165
+ if ( actual . Name != expected . Name )
166
+ throw new Exception ( $ "{ actual . Name } != { expected . Name } ") ;
167
+ if ( actual . Guid != expected . Guid )
168
+ throw new Exception ( $ "{ actual . Guid } != { expected . Guid } ") ;
169
+ if ( actual . LongId != expected . LongId )
170
+ throw new Exception ( $ "{ actual . LongId } != { expected . LongId } ") ;
171
+ if ( actual . Bool != expected . Bool )
172
+ throw new Exception ( $ "{ actual . Bool } != { expected . Bool } ") ;
173
+
174
+ if ( actual . DateTime . RoundToSecond ( ) != expected . DateTime . RoundToSecond ( ) )
175
+ throw new Exception ( $ "{ actual . DateTime . RoundToSecond ( ) } != { expected . DateTime . RoundToSecond ( ) } ") ;
176
+
177
+ if ( Math . Abs ( actual . Double - expected . Double ) > 1 )
178
+ throw new Exception ( $ "{ actual . Double } != { expected . Double } ") ;
186
179
}
187
180
}
188
181
}
0 commit comments