Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "10.0.100",
"rollForward": "latestMajor"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "10.0.100",
"rollForward": "latestMajor"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "10.0.100",
"rollForward": "latestMajor"
}
}
14 changes: 10 additions & 4 deletions tests/dotnet-test/writing-mstest-tests/eval.vally.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ stimuli:
- Seals the test class
- name: Fix swapped Assert.AreEqual arguments
prompt: |
Something seems off with my MSTest tests — can you review and fix the MSTest assertions following MSTest best practices?
Review and fix these MSTest assertions following MSTest best practices. Leave anything that is already correct untouched.

```csharp
[TestClass]
Expand Down Expand Up @@ -149,6 +149,8 @@ stimuli:
dest: PriceCalculatorTests.cs
- src: fixtures/legacy-antipatterns/PriceCalculator.cs
dest: PriceCalculator.cs
- src: fixtures/legacy-antipatterns/global.json
dest: global.json
graders:
- type: output-matches
config:
Expand All @@ -172,7 +174,7 @@ stimuli:
- Replaces manual foreach test data loop with [DataRow] or [DynamicData] attributes
- name: Replace ExpectedException with Assert.Throws
prompt: |
I have this MSTest test that uses [ExpectedException]. How should I modernize it to use Assert.ThrowsExactly instead, following MSTest best practices?
Modernize this MSTest test to replace [ExpectedException] with Assert.ThrowsExactly, following MSTest best practices.

```csharp
[TestMethod]
Expand Down Expand Up @@ -248,7 +250,7 @@ stimuli:
- create
- name: Use proper type assertions instead of casts
prompt: |
I'm writing MSTest tests for a factory method. Is there a better MSTest assertion to check the returned type instead of hard casting, following MSTest best practices?
Rewrite this MSTest test for a factory method to replace the hard cast with a proper type-checking assertion, following MSTest best practices.

```csharp
[TestMethod]
Expand Down Expand Up @@ -285,6 +287,8 @@ stimuli:
files:
- src: fixtures/modern-mstest/TestProject.csproj
dest: TestProject.csproj
- src: fixtures/modern-mstest/global.json
dest: global.json
graders:
- type: output-matches
config:
Expand All @@ -307,7 +311,7 @@ stimuli:
- If TestContext property is used, does not add nullable annotation or = null! initializer
- name: Use DynamicData with ValueTuples over object arrays
prompt: |
I have this MSTest data-driven test using DynamicData with object arrays. Is there a more type-safe way to write this following modern MSTest best practices?
Rewrite this data-driven MSTest test to use type-safe ValueTuples instead of object arrays, following modern MSTest best practices.

```csharp
[TestMethod]
Expand Down Expand Up @@ -470,6 +474,8 @@ stimuli:
dest: src/Contoso.Services.csproj
- src: ./fixtures/service-registry/tests/Contoso.Services.Tests.csproj
dest: tests/Contoso.Services.Tests.csproj
- src: ./fixtures/service-registry/global.json
dest: global.json
graders:
- type: file-exists
config:
Expand Down
12 changes: 9 additions & 3 deletions tests/dotnet-test/writing-mstest-tests/eval.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ scenarios:
source: "fixtures/legacy-antipatterns/PriceCalculatorTests.cs"
- path: "PriceCalculator.cs"
source: "fixtures/legacy-antipatterns/PriceCalculator.cs"
- path: "global.json"
source: "fixtures/legacy-antipatterns/global.json"
commands:
- "dotnet restore"
assertions:
Expand All @@ -169,7 +171,7 @@ scenarios:

- name: "Replace ExpectedException with Assert.Throws"
prompt: |
I have this MSTest test that uses [ExpectedException]. How should I modernize it to use Assert.ThrowsExactly instead?
Modernize this MSTest test to replace [ExpectedException] with Assert.ThrowsExactly, following MSTest best practices.

```csharp
[TestMethod]
Expand Down Expand Up @@ -228,7 +230,7 @@ scenarios:

- name: "Use proper type assertions instead of casts"
prompt: |
I'm writing MSTest tests for a factory method. Is there a better MSTest assertion to check the returned type instead of hard casting?
Rewrite this MSTest test for a factory method to replace the hard cast with a proper type-checking assertion, following MSTest best practices.

```csharp
[TestMethod]
Expand Down Expand Up @@ -264,6 +266,8 @@ scenarios:
files:
- path: "TestProject.csproj"
source: "fixtures/modern-mstest/TestProject.csproj"
- path: "global.json"
source: "fixtures/modern-mstest/global.json"
assertions:
- type: output_matches
pattern: "constructor|\\bctor\\b"
Expand All @@ -282,7 +286,7 @@ scenarios:

- name: "Use DynamicData with ValueTuples over object arrays"
prompt: |
I have this MSTest data-driven test using DynamicData with object arrays. Is there a more type-safe way to write this in modern MSTest?
Rewrite this data-driven MSTest test to use type-safe ValueTuples instead of object arrays, following modern MSTest best practices.

```csharp
[TestMethod]
Expand Down Expand Up @@ -470,6 +474,8 @@ scenarios:
<ProjectReference Include="../src/Contoso.Services.csproj" />
</ItemGroup>
</Project>
- path: "global.json"
source: "fixtures/service-registry/global.json"
assertions:
- type: file_exists
path: "tests/*.cs"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"rollForward": "latestMajor"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "9.0.100",
"rollForward": "latestMajor"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "9.0.100",
"rollForward": "latestMajor"
}
}