Skip to content

Commit d45fbab

Browse files
committed
Update tests to support latest Test.SDK 18.0.1
1 parent cf18180 commit d45fbab

File tree

3 files changed

+39
-39
lines changed

3 files changed

+39
-39
lines changed

SecurityDriven.Core.Tests/CryptoRandomTests.cs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ namespace SecurityDriven.Core.Tests
1515
public class CryptoRandomTests
1616
{
1717
#region System.Random tests
18-
[DataTestMethod]
18+
[TestMethod]
1919
[DataRow(false, false)]
2020
[DataRow(false, true)]
2121
[DataRow(true, false)]
2222
[DataRow(true, true)]
2323
public void InvalidArguments_Throws(bool derived, bool seeded)
2424
{
2525
Random r = Create(derived, seeded);
26-
Assert.ThrowsException<ArgumentNullException>(() => r.NextBytes(null));
27-
Assert.ThrowsException<ArgumentOutOfRangeException>(() => r.Next(-1));
28-
Assert.ThrowsException<ArgumentOutOfRangeException>(() => r.Next(2, 1));
26+
Assert.Throws<ArgumentNullException>(() => r.NextBytes(null));
27+
Assert.Throws<ArgumentOutOfRangeException>(() => r.Next(-1));
28+
Assert.Throws<ArgumentOutOfRangeException>(() => r.Next(2, 1));
2929
}//InvalidArguments_Throws()
3030

31-
[DataTestMethod]
31+
[TestMethod]
3232
[DataRow(false, false)]
3333
[DataRow(false, true)]
3434
[DataRow(true, false)]
@@ -52,7 +52,7 @@ public void SmallRanges_ReturnsExpectedValue(bool derived, bool seeded)
5252
Assert.IsTrue(1 == r.NextInt64(1, 2));
5353
}//SmallRanges_ReturnsExpectedValue()
5454

55-
[DataTestMethod]
55+
[TestMethod]
5656
[DataRow(false, false)]
5757
[DataRow(false, true)]
5858
[DataRow(true, false)]
@@ -84,7 +84,7 @@ public void NextInt_AllValuesAreWithinSpecifiedRange(bool derived, bool seeded)
8484
}
8585
}//NextInt_AllValuesAreWithinSpecifiedRange()
8686

87-
[DataTestMethod]
87+
[TestMethod]
8888
[DataRow(false, false)]
8989
[DataRow(false, true)]
9090
[DataRow(true, false)]
@@ -108,7 +108,7 @@ public void Next_Int_AllValuesWithinSmallRangeHit(bool derived, bool seeded)
108108
Assert.IsTrue(!hs.Contains(4));
109109
}//Next_Int_AllValuesWithinSmallRangeHit()
110110

111-
[DataTestMethod]
111+
[TestMethod]
112112
[DataRow(false, false)]
113113
[DataRow(false, true)]
114114
[DataRow(true, false)]
@@ -161,7 +161,7 @@ public void Next_IntInt_Next_IntInt_AllValuesAreWithinRange()
161161
}//foreach
162162
}//Next_IntInt_Next_IntInt_AllValuesAreWithinRange()
163163

164-
[DataTestMethod]
164+
[TestMethod]
165165
[DataRow(false, false)]
166166
[DataRow(false, true)]
167167
[DataRow(true, false)]
@@ -185,7 +185,7 @@ public void Next_Long_AllValuesWithinSmallRangeHit(bool derived, bool seeded)
185185
Assert.IsTrue(!hs.Contains(4L));
186186
}//Next_Long_AllValuesWithinSmallRangeHit()
187187

188-
[DataTestMethod]
188+
[TestMethod]
189189
[DataRow(false, false)]
190190
[DataRow(false, true)]
191191
[DataRow(true, false)]
@@ -238,7 +238,7 @@ public void Next_LongLong_Next_IntInt_AllValuesAreWithinRange()
238238
}//foreach
239239
}//Next_LongLong_Next_IntInt_AllValuesAreWithinRange()
240240

241-
[DataTestMethod]
241+
[TestMethod]
242242
[DataRow(false)]
243243
[DataRow(true)]
244244
public void CtorWithSeed_SequenceIsRepeatable(bool derived)
@@ -269,7 +269,7 @@ public void CtorWithSeed_SequenceIsRepeatable(bool derived)
269269
}
270270
}//CtorWithSeed_SequenceIsRepeatable()
271271

272-
[DataTestMethod]
272+
[TestMethod]
273273
[DataRow(false)]
274274
[DataRow(true)]
275275
public void ExpectedValues(bool derived)
@@ -324,7 +324,7 @@ public void ExpectedValues(bool derived)
324324
*/
325325
}//ExpectedValues()
326326

327-
[DataTestMethod]
327+
[TestMethod]
328328
[DataRow(false)]
329329
[DataRow(true)]
330330
public void ExpectedValues_NextBytes(bool derived)
@@ -385,7 +385,7 @@ public void ExpectedValues_NextBytes(bool derived)
385385
*/
386386
}//ExpectedValues_NextBytes()
387387

388-
[DataTestMethod]
388+
[TestMethod]
389389
[DataRow(false)]
390390
[DataRow(true)]
391391
public void Sample(bool seeded)
@@ -398,7 +398,7 @@ public void Sample(bool seeded)
398398
}
399399
}//Sample()
400400

401-
[DataTestMethod]
401+
[TestMethod]
402402
[DataRow(false, false)]
403403
[DataRow(false, true)]
404404
[DataRow(true, false)]
@@ -418,7 +418,7 @@ public void Shared_IsSingleton()
418418
Assert.AreSame(CryptoRandom.Shared, Task.Run(() => CryptoRandom.Shared).Result);
419419
}//Shared_IsSingleton()
420420

421-
[DataTestMethod]
421+
[TestMethod]
422422
[DataRow(false)]
423423
[DataRow(true)]
424424
public void RandomDistributionBug(bool seeded)
@@ -455,7 +455,7 @@ public void RandomDistributionBug(bool seeded)
455455
}
456456
}//RandomDistributionBug()
457457

458-
[DataTestMethod]
458+
[TestMethod]
459459
[DataRow(false)]
460460
[DataRow(true)]
461461
public void RandomDistributionBug_OddEven(bool seeded)
@@ -494,7 +494,7 @@ public void RandomDistributionBug_OddEven(bool seeded)
494494
}
495495
}//RandomDistributionBug_OddEven()
496496

497-
[DataTestMethod]
497+
[TestMethod]
498498
[DataRow(false)]
499499
[DataRow(true)]
500500
public void SeededRandom_HashCheck(bool derived)
@@ -608,7 +608,7 @@ static void Assert_InRange(double value, double minInclusive, double maxInclusiv
608608
#endregion System.Random tests
609609

610610
#region RandomNumberGenerator tests
611-
[DataTestMethod]
611+
[TestMethod]
612612
[DataRow(2048)]
613613
[DataRow(65536)]
614614
[DataRow(1048576)]
@@ -674,7 +674,7 @@ public void ConcurrentAccess()
674674
}
675675
}//ConcurrentAccess()
676676

677-
[DataTestMethod]
677+
[TestMethod]
678678
[DataRow(400)]
679679
[DataRow(65536)]
680680
[DataRow(1048576)]
@@ -718,7 +718,7 @@ public void GetBytes_Array_Offset_ZeroCount()
718718
rng.NextBytes(new Span<byte>(rand, 0, 0));
719719
}//GetBytes_Array_Offset_ZeroCount()
720720

721-
[DataTestMethod]
721+
[TestMethod]
722722
[DataRow(10)]
723723
[DataRow(256)]
724724
[DataRow(65536)]
@@ -744,7 +744,7 @@ public void DifferentSequential_Array(int arraySize)
744744
Assert.IsFalse(Enumerable.SequenceEqual(first, second));
745745
}//DifferentSequential_Array()
746746

747-
[DataTestMethod]
747+
[TestMethod]
748748
[DataRow(10)]
749749
[DataRow(256)]
750750
[DataRow(65536)]
@@ -775,17 +775,17 @@ public void DifferentParallel(int arraySize)
775775
public void NextBytes_InvalidArgs()
776776
{
777777
CryptoRandom rng = new CryptoRandom();
778-
Assert.ThrowsException<ArgumentNullException>(() => rng.NextBytes(null));
778+
Assert.Throws<ArgumentNullException>(() => rng.NextBytes(null));
779779
rng.NextBytes(new Span<byte>(null, 0, 0)); // should not throw, and just do nothing
780-
Assert.ThrowsException<ArgumentOutOfRangeException>(() => rng.NextBytes(new Span<byte>(Array.Empty<byte>(), -1, 0)));
781-
Assert.ThrowsException<ArgumentOutOfRangeException>(() => rng.NextBytes(new Span<byte>(Array.Empty<byte>(), 0, -1)));
782-
Assert.ThrowsException<ArgumentOutOfRangeException>(() => rng.NextBytes(new Span<byte>(Array.Empty<byte>(), 0, 1)));
780+
Assert.Throws<ArgumentOutOfRangeException>(() => rng.NextBytes(new Span<byte>(Array.Empty<byte>(), -1, 0)));
781+
Assert.Throws<ArgumentOutOfRangeException>(() => rng.NextBytes(new Span<byte>(Array.Empty<byte>(), 0, -1)));
782+
Assert.Throws<ArgumentOutOfRangeException>(() => rng.NextBytes(new Span<byte>(Array.Empty<byte>(), 0, 1)));
783783
}//NextBytes_InvalidArgs()
784784

785785
[TestMethod]
786786
public void NextBytes_Int_Negative()
787787
{
788-
Assert.ThrowsException<ArgumentOutOfRangeException>(() => CryptoRandom.Shared.NextBytes(-1));
788+
Assert.Throws<ArgumentOutOfRangeException>(() => CryptoRandom.Shared.NextBytes(-1));
789789
}//NextBytes_Int_Negative()
790790

791791
[TestMethod]
@@ -823,7 +823,7 @@ public void Fill_SpanLength1()
823823
Assert.IsTrue(replacedValue, "Fill eventually wrote a different byte");
824824
}//Fill_SpanLength1()
825825

826-
[DataTestMethod]
826+
[TestMethod]
827827
[DataRow(1 << 1)]
828828
[DataRow(1 << 4)]
829829
[DataRow(1 << 16)]
@@ -837,7 +837,7 @@ public void Next_PowersOfTwo(int toExclusive)
837837
}
838838
}//Next_PowersOfTwo()
839839

840-
[DataTestMethod]
840+
[TestMethod]
841841
[DataRow((1 << 1) + 1)]
842842
[DataRow((1 << 4) + 1)]
843843
[DataRow((1 << 16) + 1)]
@@ -944,7 +944,7 @@ public void GetInt32_1000d6()
944944
VerifyDistribution(generated, 0.16);
945945
}//GetInt32_1000d6()
946946

947-
[DataTestMethod]
947+
[TestMethod]
948948
[DataRow(int.MinValue, int.MinValue + 3)]
949949
[DataRow(-257, -129)]
950950
[DataRow(-100, 5)]
@@ -1275,7 +1275,7 @@ public void CryptoRandom_ConcurrentAccess()
12751275

12761276
#endregion
12771277

1278-
[DataTestMethod]
1278+
[TestMethod]
12791279
[DataRow(false, false)]
12801280
[DataRow(false, true)]
12811281
[DataRow(true, false)]
@@ -1290,7 +1290,7 @@ public void SingleByte(bool derived, bool seeded)
12901290
}
12911291
}//SingleByte()
12921292

1293-
[DataTestMethod]
1293+
[TestMethod]
12941294
[DataRow(false, false)]
12951295
[DataRow(false, true)]
12961296
[DataRow(true, false)]
@@ -1300,7 +1300,7 @@ public void Reseed(bool derived, bool seeded)
13001300
CryptoRandom cr = Create(derived, seeded);
13011301
if (!seeded)
13021302
{
1303-
Assert.ThrowsException<NotImplementedException>(() => cr.Reseed(new byte[32]));
1303+
Assert.Throws<NotImplementedException>(() => cr.Reseed(new byte[32]));
13041304
return;
13051305
}
13061306

@@ -1315,7 +1315,7 @@ public void Reseed(bool derived, bool seeded)
13151315
Assert.IsTrue(Enumerable.SequenceEqual(randomData1, randomData2));
13161316
}//Reseed()
13171317

1318-
[DataTestMethod]
1318+
[TestMethod]
13191319
public void ParallelGuid()
13201320
{
13211321
CryptoRandom cr = Create(derived: false, seeded: false);

SecurityDriven.Core.Tests/SanityTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace SecurityDriven.Core.Tests
88
[TestClass]
99
public class SanityTests
1010
{
11-
[DataTestMethod]
11+
[TestMethod]
1212
[DataRow(1, 0, 9 /*, "alpha" */)]
1313
public void VersionCheck(int major, int minor, int build, string releaseType = "")
1414
{

SecurityDriven.Core.Tests/SecurityDriven.Core.Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net10.0;net9.0;net8.0;net7.0;net6.0;</TargetFrameworks>
4+
<TargetFrameworks>net10.0;net9.0;net8.0;</TargetFrameworks>
55

66
<IsPackable>false</IsPackable>
77
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
12-
<PackageReference Include="MSTest.TestAdapter" Version="3.8.0" />
13-
<PackageReference Include="MSTest.TestFramework" Version="3.8.0" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
12+
<PackageReference Include="MSTest.TestAdapter" Version="4.0.2" />
13+
<PackageReference Include="MSTest.TestFramework" Version="4.0.2" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

0 commit comments

Comments
 (0)