Skip to content

Commit

Permalink
Test coverage for TestContext analyzer for case sensitivity (#4438)
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 authored Dec 23, 2024
1 parent ccf922f commit fdf27d2
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,35 @@ await VerifyCS.VerifyCodeFixAsync(
fixedCode);
}

[TestMethod]
public async Task WhenTestContextPropertyIsNotCasedCorrectly_Diagnostic()
{
string code = $$"""
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class MyTestClass
{
public TestContext {|#0:testContext|} { get; set; }
}
""";
string fixedCode = $$"""
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class MyTestClass
{
public TestContext TestContext { get; set; }
}
""";

await VerifyCS.VerifyCodeFixAsync(
code,
VerifyCS.Diagnostic(TestContextShouldBeValidAnalyzer.TestContextShouldBeValidRule)
.WithLocation(0),
fixedCode);
}

[TestMethod]
public async Task WhenTestContextPropertyIsReadonly_AssignedInConstructor_NoDiagnostic()
{
Expand Down

0 comments on commit fdf27d2

Please sign in to comment.