-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix DataRowAttribute to be cls compliant (#1878)
- Loading branch information
1 parent
182d095
commit 8c9530e
Showing
6 changed files
with
95 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
#nullable enable | ||
Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute.DataRowAttribute(object? data) -> void |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using Microsoft.MSTestV2.CLIAutomation; | ||
|
||
namespace MSTest.IntegrationTests; | ||
|
||
public class ClsTests : CLITestBase | ||
{ | ||
private const string TestAssetName = "ClsTestProject"; | ||
|
||
public void TestsAreRun() | ||
{ | ||
// Arrange | ||
var assemblyPath = GetAssetFullPath(TestAssetName); | ||
|
||
// Act | ||
var testCases = DiscoverTests(assemblyPath); | ||
var testResults = RunTests(testCases); | ||
|
||
// Assert | ||
VerifyE2E.TestsPassed( | ||
testResults, | ||
"TestMethod", | ||
"IntDataRow (10)", | ||
"StringDataRow (some string)"); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
test/IntegrationTests/TestAssets/ClsTestProject/ClsTestProject.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net462</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="$(RepoRoot)src\Adapter\MSTest.TestAdapter\MSTest.TestAdapter.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
34 changes: 34 additions & 0 deletions
34
test/IntegrationTests/TestAssets/ClsTestProject/MyTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
[assembly: CLSCompliant(true)] | ||
|
||
namespace DataRowTestProject; | ||
|
||
[TestClass] | ||
public class ClsTests | ||
{ | ||
[TestMethod] | ||
public void TestMethod() | ||
{ | ||
Assert.IsTrue(true); | ||
} | ||
|
||
[TestMethod] | ||
[DataRow(10)] | ||
public void IntDataRow(int i) | ||
{ | ||
Assert.IsTrue(i != 0); | ||
} | ||
|
||
[TestMethod] | ||
[DataRow("some string")] | ||
public void StringDataRow(string s) | ||
{ | ||
Assert.IsNotNull(s); | ||
} | ||
} |