|
2 | 2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
3 | 3 | using FluentAssertions.Analyzers.Xunit;
|
4 | 4 |
|
5 |
| -using XunitAssert = Xunit.Assert; |
6 |
| - |
7 | 5 | namespace FluentAssertions.Analyzers.Tests.Tips
|
8 | 6 | {
|
9 | 7 | [TestClass]
|
@@ -368,6 +366,36 @@ public void AssertStringContains_TestAnalyzer(string assertion) =>
|
368 | 366 | public void AssertStringContains_TestCodeFix(string oldAssertion, string newAssertion)
|
369 | 367 | => VerifyCSharpFix<AssertContainsCodeFix, AssertContainsAnalyzer>("string actual, string expected", oldAssertion, newAssertion);
|
370 | 368 |
|
| 369 | + [DataTestMethod] |
| 370 | + [DataRow("Assert.Contains(expected, actual);", "ISet<string> actual, string expected")] |
| 371 | + [DataRow("Assert.Contains(expected, actual);", "IReadOnlySet<string> actual, string expected")] |
| 372 | + [DataRow("Assert.Contains(expected, actual);", "HashSet<string> actual, string expected")] |
| 373 | + [DataRow("Assert.Contains(expected, actual);", "ImmutableHashSet<string> actual, string expected")] |
| 374 | + [Implemented] |
| 375 | + public void AssertSetContains_TestAnalyzer(string assertion, string arguments) => |
| 376 | + VerifyCSharpDiagnostic<AssertContainsAnalyzer>(arguments, assertion); |
| 377 | + |
| 378 | + [DataTestMethod] |
| 379 | + [DataRow( |
| 380 | + /* oldAssertion: */ "Assert.Contains(expected, actual);", |
| 381 | + /* newAssertion: */ "actual.Should().Contain(expected);", |
| 382 | + /* arguments: */ "ISet<string> actual, string expected")] |
| 383 | + [DataRow( |
| 384 | + /* oldAssertion: */ "Assert.Contains(expected, actual);", |
| 385 | + /* newAssertion: */ "actual.Should().Contain(expected);", |
| 386 | + /* arguments: */ "IReadOnlySet<string> actual, string expected")] |
| 387 | + [DataRow( |
| 388 | + /* oldAssertion: */ "Assert.Contains(expected, actual);", |
| 389 | + /* newAssertion: */ "actual.Should().Contain(expected);", |
| 390 | + /* arguments: */ "HashSet<string> actual, string expected")] |
| 391 | + [DataRow( |
| 392 | + /* oldAssertion: */ "Assert.Contains(expected, actual);", |
| 393 | + /* newAssertion: */ "actual.Should().Contain(expected);", |
| 394 | + /* arguments: */ "ImmutableHashSet<string> actual, string expected")] |
| 395 | + [Implemented] |
| 396 | + public void AssertSetContains_TestCodeFix(string oldAssertion, string newAssertion, string arguments) |
| 397 | + => VerifyCSharpFix<AssertContainsCodeFix, AssertContainsAnalyzer>(arguments, oldAssertion, newAssertion); |
| 398 | + |
371 | 399 | [DataTestMethod]
|
372 | 400 | [DataRow("Assert.DoesNotContain(expected, actual);")]
|
373 | 401 | [Implemented]
|
@@ -494,7 +522,7 @@ public void AssertStartsWith_TestCodeFix(string oldAssertion, string newAssertio
|
494 | 522 | Message = message,
|
495 | 523 | Locations = new DiagnosticResultLocation[]
|
496 | 524 | {
|
497 |
| - new("Test0.cs", 14, 13) |
| 525 | + new("Test0.cs", 15, 13) |
498 | 526 | },
|
499 | 527 | Severity = DiagnosticSeverity.Info
|
500 | 528 | });
|
|
0 commit comments