@@ -23,7 +23,7 @@ public void DateTime_ConstructorTest1()
23
23
OutputHelper . WriteLine ( dt . ToString ( ) ) ;
24
24
Type type = dt . GetType ( ) ;
25
25
// Verifying its type
26
- Assert . IsType ( type , Type . GetType ( "System.DateTime" ) ) ;
26
+ Assert . IsInstanceOfType ( type , Type . GetType ( "System.DateTime" ) ) ;
27
27
}
28
28
29
29
[ TestMethod ]
@@ -49,7 +49,7 @@ public void DateTime_ConstructorTest2()
49
49
dt . Hour + ":" + dt . Minute + ":" + dt . Second + ":" + dt . Millisecond + "'" ) ;
50
50
}
51
51
Type t = dt . GetType ( ) ;
52
- Assert . IsType ( t , Type . GetType ( "System.DateTime" ) ) ;
52
+ Assert . IsInstanceOfType ( t , Type . GetType ( "System.DateTime" ) ) ;
53
53
}
54
54
}
55
55
@@ -301,7 +301,6 @@ public void DateTime_ToStringTest10()
301
301
// expected format is dddd, dd MMMM yyyy HH:mm
302
302
303
303
int minLength = 25 ;
304
- int actualLength = dtOutput1 . Length ;
305
304
306
305
// check length
307
306
Assert . IsTrue ( dtOutput1 . Length >= minLength , $ "Wrong output1 length: { dtOutput1 . Length } , should have been at least { minLength } ") ;
@@ -386,7 +385,6 @@ public void DateTime_ToStringTest11()
386
385
// expected format is dddd, dd MMMM yyyy HH:mm:ss
387
386
388
387
int minLength = 26 ;
389
- int actualLength = dtOutput1 . Length ;
390
388
391
389
// check length
392
390
Assert . IsTrue ( dtOutput1 . Length >= minLength , $ "Wrong output1 length: { dtOutput1 . Length } , should have been at least { minLength } ") ;
@@ -1774,10 +1772,10 @@ public void DateTime_AddTicks_PositiveTest20()
1774
1772
for ( int i = 0 ; i < dt1Arr . Length ; i ++ )
1775
1773
{
1776
1774
DateTime dt1 = dt1Arr [ i ] ;
1777
- long ticks = ( long ) random . Next ( 1000 ) ;
1775
+ long ticksVAlue = random . Next ( 1000 ) ;
1778
1776
// Adding '" + ticks + "' ticks to '" + dt1.ToString() + "'
1779
- DateTime dt2 = dt1 . AddTicks ( ticks ) ;
1780
- Assert . AreEqual ( dt2 . Ticks , ( dt1 . Ticks + ticks ) ) ;
1777
+ DateTime dt2 = dt1 . AddTicks ( ticksVAlue ) ;
1778
+ Assert . AreEqual ( dt2 . Ticks , ( dt1 . Ticks + ticksVAlue ) ) ;
1781
1779
}
1782
1780
}
1783
1781
@@ -1795,10 +1793,10 @@ public void DateTime_AddTicks_NegativeTest21()
1795
1793
for ( int i = 0 ; i < 10 ; i ++ )
1796
1794
{
1797
1795
DateTime dt1 = dt1Arr [ i ] ;
1798
- long ticks = - ( long ) random . Next ( 1000 ) ;
1796
+ long ticksValue = - ( long ) random . Next ( 1000 ) ;
1799
1797
// Adding '" + ticks + "' ticks to '" + dt1.ToString() + "'
1800
- DateTime dt2 = dt1 . AddTicks ( ticks ) ;
1801
- Assert . AreEqual ( dt2 . Ticks , ( dt1 . Ticks + ticks ) ) ;
1798
+ DateTime dt2 = dt1 . AddTicks ( ticksValue ) ;
1799
+ Assert . AreEqual ( dt2 . Ticks , ( dt1 . Ticks + ticksValue ) ) ;
1802
1800
}
1803
1801
}
1804
1802
@@ -2113,7 +2111,7 @@ public void DateTime_DateTest41()
2113
2111
DateTime dt = GetRandomDateTime ( ) ;
2114
2112
DateTime _date = dt . Date ;
2115
2113
if ( ( _date . Year != dt . Year ) || ( _date . Month != dt . Month ) || ( _date . Day != dt . Day ) ||
2116
- ( _date . Hour != 0 ) || ( _date . Minute != 0 ) | ( _date . Second != 0 ) || ( _date . Millisecond != 0 ) )
2114
+ ( _date . Hour != 0 ) || ( _date . Minute != 0 ) || ( _date . Second != 0 ) || ( _date . Millisecond != 0 ) )
2117
2115
{
2118
2116
throw new Exception ( "Failure : expected Date(mm/dd/yr/hr/mn/sec/msec) = '" + dt . Month + "/" + dt . Day +
2119
2117
"/" + dt . Year + "/0:0:0:0' but got '" + _date . Month + "/" + _date . Day + "/" +
@@ -2272,16 +2270,16 @@ public void DateTime_BelowMinDateTime_ArgumentOutOfRangeExceptionTest58()
2272
2270
{
2273
2271
// Creating a DateTime with -ve Ticks and,
2274
2272
// verifying ArgumentOutOfRangeException is thrown
2275
- Assert . ThrowsException ( typeof ( ArgumentOutOfRangeException ) , ( ) => { DateTime dt = new DateTime ( - ( new Random ( ) . Next ( 10 ) + 1 ) ) ; } ) ;
2273
+ Assert . ThrowsException ( typeof ( ArgumentOutOfRangeException ) , ( ) => { _ = new DateTime ( - ( new Random ( ) . Next ( 10 ) + 1 ) ) ; } ) ;
2276
2274
}
2277
2275
2278
2276
[ TestMethod ]
2279
2277
public void DateTime_AboveMaxDatTime_ArgumentOutOfRangeExceptionTest59 ( )
2280
2278
{
2281
2279
// Creating a DateTime later than DateTime.MaxValue and,
2282
2280
// verifying ArgumentOutOfRangeException is thrown
2283
- Assert . ThrowsException ( typeof ( ArgumentOutOfRangeException ) , ( ) => { DateTime dt1 = new DateTime ( DateTime . MaxValue . Ticks + 1 ) ; } ) ;
2284
- Assert . ThrowsException ( typeof ( ArgumentOutOfRangeException ) , ( ) => { DateTime dt2 = new DateTime ( 10000 , 1 , 1 , 0 , 0 , 0 , 0 ) ; } ) ;
2281
+ Assert . ThrowsException ( typeof ( ArgumentOutOfRangeException ) , ( ) => { _ = new DateTime ( DateTime . MaxValue . Ticks + 1 ) ; } ) ;
2282
+ Assert . ThrowsException ( typeof ( ArgumentOutOfRangeException ) , ( ) => { _ = new DateTime ( 10000 , 1 , 1 , 0 , 0 , 0 , 0 ) ; } ) ;
2285
2283
}
2286
2284
2287
2285
[ TestMethod ]
0 commit comments