Skip to content

Commit cb266c3

Browse files
authored
MSTest 3.11 (#141)
* MSTest 3.11 https://github.com/microsoft/testfx/releases/tag/v3.11.0 * Code fixes * Update global.json * Fix command line * .NET 10 SDK * Fix * Fix * Update pr-ci.yml
1 parent 49daa16 commit cb266c3

File tree

7 files changed

+14
-11
lines changed

7 files changed

+14
-11
lines changed

.azuredevops/pipelines/pr-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
inputs:
6060
command: test
6161
projects: $(Build.SourcesDirectory)/MSBuildCache.sln
62-
arguments: -restore:false --no-build --configuration $(BuildConfiguration) -- --report-trx --results-directory $(Agent.TempDirectory)
62+
arguments: --no-build --configuration $(BuildConfiguration)
6363

6464
- publish: $(ArtifactsDirectory)
6565
displayName: Publish Artifacts

global.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"rollForward": "latestFeature"
55
},
66
"msbuild-sdks": {
7-
"MSTest.Sdk": "3.9.1"
7+
"MSTest.Sdk": "3.11.1"
8+
},
9+
"test": {
10+
"runner": "Microsoft.Testing.Platform"
811
}
912
}

src/Common.Tests/Hashing/DirectoryFileHasherTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class DirectoryFileHasherTests
1919
public TestContext TestContext { get; set; }
2020
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
2121

22-
[DataTestMethod]
22+
[TestMethod]
2323
[DataRow(@"X:\Dir\Foo\1.0.0\lib\Foo.dll", true)]
2424
[DataRow(@"x:\dIR\Foo\1.0.0\lib\Foo.dll", true)]
2525
[DataRow(@"x:\OtherDir\foo.txt", false)]
@@ -30,7 +30,7 @@ public void ContainsPath(string path, bool expectedResult)
3030
Assert.AreEqual(expectedResult, hasher.ContainsPath(path));
3131
}
3232

33-
[DataTestMethod]
33+
[TestMethod]
3434
[DataRow(@"Dir\Foo\1.0.0\lib\Foo.dll", true)]
3535
[DataRow(@"dIR\Foo\2.0.0\lib\Foo.dll", true)]
3636
[DataRow(@"OtherDir\foo.txt", false)]

src/Common.Tests/Hashing/OutputHasherTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public async Task ComputeHashFileNotFound()
5050
string file = Path.Combine(dir, "file.txt");
5151

5252
// Ensure exceptions are propagated correctly.
53-
await Assert.ThrowsExceptionAsync<FileNotFoundException>(async () => await hasher.ComputeHashAsync(file, CancellationToken.None));
53+
await Assert.ThrowsExactlyAsync<FileNotFoundException>(async () => await hasher.ComputeHashAsync(file, CancellationToken.None));
5454
}
5555

5656
[TestMethod]

src/Common.Tests/HexUtilitiesTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Microsoft.MSBuildCache.Tests;
1010
[TestClass]
1111
public class HexUtilitiesTests
1212
{
13-
[DataTestMethod]
13+
[TestMethod]
1414
[DataRow("0123456789ABCDEFabcdef", new byte[] { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0xAB, 0xCD, 0xEF, })]
1515
[DataRow("", null)]
1616
[DataRow(null, null)]
@@ -29,12 +29,12 @@ public void HexToBytes(string hex, byte[]? expectedBytes)
2929
Assert.AreEqual(expectedBytes.Length, bytes.Length);
3030
for (int i = 0; i < expectedBytes.Length; i++)
3131
{
32-
Assert.AreEqual(expectedBytes[i], bytes[i], "Index {0}", i);
32+
Assert.AreEqual(expectedBytes[i], bytes[i], $"Index {i}");
3333
}
3434
}
3535

3636
[TestMethod]
37-
public void HexToBytesOddChars() => Assert.ThrowsException<ArgumentException>(() => HexUtilities.HexToBytes("fAbCd"));
37+
public void HexToBytesOddChars() => Assert.ThrowsExactly<ArgumentException>(() => HexUtilities.HexToBytes("fAbCd"));
3838

3939
[TestMethod]
4040
public void HexToBytesBadChars()

src/Common.Tests/PathHelperTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.MSBuildCache.Tests;
88
[TestClass]
99
public class PathHelperTests
1010
{
11-
[DataTestMethod]
11+
[TestMethod]
1212
[DataRow(@"X:\A\B\C", @"X:\A", @"B\C")]
1313
// Lots of .. and .
1414
[DataRow(@"X:\Z\..\A\B\.\C", @"X:\Y\..\D\..\A\.\.", @"B\C")]
@@ -27,7 +27,7 @@ public class PathHelperTests
2727
public void MakePathRelative(string path, string basePath, string? expectedResult)
2828
=> Assert.AreEqual(expectedResult, path.MakePathRelativeTo(basePath));
2929

30-
[DataTestMethod]
30+
[TestMethod]
3131
[DataRow(@"X:\A\B\C\file.txt", @"X:\A", true)]
3232
// Lots of .. and .
3333
[DataRow(@"X:\Z\..\A\B\.\C\file.txt", @"X:\Y\..\D\..\A\.\.", true)]

src/Repack.Tests/RepackTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Microsoft.MSBuildCache.Repack.Tests;
1616
[TestClass]
1717
public class RepackTests
1818
{
19-
[DataTestMethod]
19+
[TestMethod]
2020
[DataRow(typeof(MSBuildCacheAzureBlobStoragePlugin))]
2121
[DataRow(typeof(MSBuildCacheAzurePipelinesPlugin))]
2222
[DataRow(typeof(MSBuildCacheLocalPlugin))]

0 commit comments

Comments
 (0)