Skip to content

Commit 1d16b43

Browse files
committed
Update PolyfillTests_MicroNanosecond.cs
1 parent 7bd2016 commit 1d16b43

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/Tests/PolyfillTests_MicroNanosecond.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,39 +35,39 @@ public async Task Microsecond()
3535
#endif
3636

3737
[Test]
38-
public void TimeSpan_FromMilliseconds_Long_CreatesCorrectTimeSpan()
38+
public async Task TimeSpan_FromMilliseconds_Long_CreatesCorrectTimeSpan()
3939
{
4040
// Arrange & Act
4141
var timeSpan = TimeSpan.FromMilliseconds(5000L);
4242

4343
// Assert
44-
Assert.AreEqual(5, timeSpan.TotalSeconds);
45-
Assert.AreEqual(5000, timeSpan.TotalMilliseconds);
44+
await Assert.That(timeSpan.TotalSeconds).IsEqualTo(5);
45+
await Assert.That(timeSpan.TotalMilliseconds).IsEqualTo(5000);
4646
}
4747

4848
[Test]
49-
public void TimeSpan_FromMilliseconds_Long_Zero()
49+
public async Task TimeSpan_FromMilliseconds_Long_Zero()
5050
{
5151
// Arrange & Act
5252
var timeSpan = TimeSpan.FromMilliseconds(0L);
5353

5454
// Assert
55-
Assert.AreEqual(TimeSpan.Zero, timeSpan);
55+
await Assert.That(timeSpan).IsEqualTo(TimeSpan.Zero);
5656
}
5757

5858
[Test]
59-
public void TimeSpan_FromMilliseconds_Long_Negative()
59+
public async Task TimeSpan_FromMilliseconds_Long_Negative()
6060
{
6161
// Arrange & Act
6262
var timeSpan = TimeSpan.FromMilliseconds(-1000L);
6363

6464
// Assert
65-
Assert.AreEqual(-1, timeSpan.TotalSeconds);
66-
Assert.AreEqual(-1000, timeSpan.TotalMilliseconds);
65+
await Assert.That(timeSpan.TotalSeconds).IsEqualTo(-1);
66+
await Assert.That(timeSpan.TotalMilliseconds).IsEqualTo(-1000);
6767
}
6868

6969
[Test]
70-
public void TimeSpan_FromMilliseconds_Long_LargeValue()
70+
public async Task TimeSpan_FromMilliseconds_Long_LargeValue()
7171
{
7272
// Arrange - 1 hour in milliseconds
7373
var oneHourMs = 3600000L;
@@ -76,61 +76,61 @@ public void TimeSpan_FromMilliseconds_Long_LargeValue()
7676
var timeSpan = TimeSpan.FromMilliseconds(oneHourMs);
7777

7878
// Assert
79-
Assert.AreEqual(1, timeSpan.TotalHours);
80-
Assert.AreEqual(60, timeSpan.TotalMinutes);
79+
await Assert.That(timeSpan.TotalHours).IsEqualTo(1);
80+
await Assert.That(timeSpan.TotalMinutes).IsEqualTo(60);
8181
}
8282

8383
[Test]
84-
public void TimeSpan_FromMilliseconds_Long_MaxValue_ThrowsOverflowException()
84+
public async Task TimeSpan_FromMilliseconds_Long_MaxValue_ThrowsOverflowException()
8585
{
8686
// Arrange - value that would overflow
8787
var tooLarge = long.MaxValue;
8888

8989
// Act & Assert - Native .NET 10+ throws ArgumentOutOfRangeException, polyfill throws OverflowException
9090
#if NET10_0_OR_GREATER
91-
Assert.Throws<ArgumentOutOfRangeException>(() => TimeSpan.FromMilliseconds(tooLarge));
91+
await Assert.That(() => TimeSpan.FromMilliseconds(tooLarge)).Throws<ArgumentOutOfRangeException>();
9292
#else
93-
Assert.Throws<OverflowException>(() => TimeSpan.FromMilliseconds(tooLarge));
93+
await Assert.That(() => TimeSpan.FromMilliseconds(tooLarge)).Throws<OverflowException>();
9494
#endif
9595
}
9696

9797
[Test]
98-
public void TimeSpan_FromMilliseconds_Long_MinValue_ThrowsOverflowException()
98+
public async Task TimeSpan_FromMilliseconds_Long_MinValue_ThrowsOverflowException()
9999
{
100100
// Arrange - value that would overflow
101101
var tooSmall = long.MinValue;
102102

103103
// Act & Assert - Native .NET 10+ throws ArgumentOutOfRangeException, polyfill throws OverflowException
104104
#if NET10_0_OR_GREATER
105-
Assert.Throws<ArgumentOutOfRangeException>(() => TimeSpan.FromMilliseconds(tooSmall));
105+
await Assert.That(() => TimeSpan.FromMilliseconds(tooSmall)).Throws<ArgumentOutOfRangeException>();
106106
#else
107-
Assert.Throws<OverflowException>(() => TimeSpan.FromMilliseconds(tooSmall));
107+
await Assert.That(() => TimeSpan.FromMilliseconds(tooSmall)).Throws<OverflowException>();
108108
#endif
109109
}
110110

111111
[Test]
112-
public void TimeSpan_FromMilliseconds_Long_NearMaxValue()
112+
public async Task TimeSpan_FromMilliseconds_Long_NearMaxValue()
113113
{
114114
// Arrange - near max safe milliseconds value
115-
const long nearMaxMilliseconds = (long.MaxValue / 10000) - 1;
115+
const long nearMaxMilliseconds = long.MaxValue / 10000 - 1;
116116

117117
// Act
118118
var timeSpan = TimeSpan.FromMilliseconds(nearMaxMilliseconds);
119119

120120
// Assert
121-
Assert.AreEqual(nearMaxMilliseconds, (long)timeSpan.TotalMilliseconds);
121+
await Assert.That((long)timeSpan.TotalMilliseconds).IsEqualTo(nearMaxMilliseconds);
122122
}
123123

124124
[Test]
125-
public void TimeSpan_FromMilliseconds_Long_NearMinValue()
125+
public async Task TimeSpan_FromMilliseconds_Long_NearMinValue()
126126
{
127127
// Arrange - near min safe milliseconds value
128-
const long nearMinMilliseconds = (long.MinValue / 10000) + 1;
128+
const long nearMinMilliseconds = long.MinValue / 10000 + 1;
129129

130130
// Act
131131
var timeSpan = TimeSpan.FromMilliseconds(nearMinMilliseconds);
132132

133133
// Assert
134-
Assert.AreEqual(nearMinMilliseconds, (long)timeSpan.TotalMilliseconds);
134+
await Assert.That((long)timeSpan.TotalMilliseconds).IsEqualTo(nearMinMilliseconds);
135135
}
136136
}

0 commit comments

Comments
 (0)