Skip to content

Commit

Permalink
Some tests are no longer relevant for NUnit 4.3 because they no longe…
Browse files Browse the repository at this point in the history
…r compile.
  • Loading branch information
manfred-brands committed Dec 22, 2024
1 parent a5e3712 commit d73461a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class IgnoreCaseUsageAnalyzerTests
private static readonly ExpectedDiagnostic expectedDiagnostic =
ExpectedDiagnostic.Create(AnalyzerIdentifiers.IgnoreCaseUsage);

#if !NUNIT4
[Test]
public void AnalyzeWhenIgnoreCaseUsedForNonStringEqualToArgument()
{
Expand All @@ -20,6 +21,7 @@ public void AnalyzeWhenIgnoreCaseUsedForNonStringEqualToArgument()

RoslynAssert.Diagnostics(analyzer, expectedDiagnostic, testCode);
}
#endif

[TestCase(nameof(Is.EqualTo))]
[TestCase(nameof(Is.EquivalentTo))]
Expand Down Expand Up @@ -103,7 +105,7 @@ public void TestMethod()
public void AnalyzeWhenIgnoreCaseUsedInConstraintCombinedByOperators()
{
var testCode = TestUtility.WrapInTestMethod(@"
Assert.That(1, Is.EqualTo(1).↓IgnoreCase | Is.EqualTo(true).↓IgnoreCase);");
Assert.That(1 == 1, Is.EqualTo(false).↓IgnoreCase | Is.EqualTo(true).↓IgnoreCase);");

RoslynAssert.Diagnostics(analyzer, expectedDiagnostic, testCode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public async Task GetConstraintNameReturnsMethodName()
[Test]
public async Task GetHelperClassNameReturnsIdentifierName()
{
var constraintPart = await CreateConstraintPart("Is.EqualTo(1).IgnoreCase").ConfigureAwait(false);
var constraintPart = await CreateConstraintPart("Is.EqualTo(\"X\").IgnoreCase").ConfigureAwait(false);

Assert.That(constraintPart.HelperClass?.Name, Is.EqualTo("Is"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public void OneTimeSetUp()
.WithMetadataReferences(existingReferences.Concat(MetadataReferences.Transitive(typeof(ImmutableArray<>))));
}

#if !NUNIT4
[TestCase(NUnitFrameworkConstants.NameOfIsEqualTo)]
#endif
[TestCase(NUnitFrameworkConstants.NameOfIsLessThan)]
[TestCase(NUnitFrameworkConstants.NameOfIsLessThanOrEqualTo)]
[TestCase(NUnitFrameworkConstants.NameOfIsGreaterThan)]
Expand All @@ -41,7 +43,9 @@ public void AnalyzeWhenAppliedToEqualityConstraintForStrings(string constraintNa
RoslynAssert.Diagnostics(analyzer, expectedDiagnostic, testCode);
}

#if !NUNIT4
[TestCase(NUnitFrameworkConstants.NameOfIsEqualTo)]
#endif
[TestCase(NUnitFrameworkConstants.NameOfIsLessThan)]
[TestCase(NUnitFrameworkConstants.NameOfIsLessThanOrEqualTo)]
[TestCase(NUnitFrameworkConstants.NameOfIsGreaterThan)]
Expand All @@ -54,6 +58,7 @@ public void AnalyzeWhenAppliedToInvertedEqualityConstraintForStrings(string cons
RoslynAssert.Diagnostics(analyzer, expectedDiagnostic, testCode);
}

#if !NUNIT4
[Test]
public void AnalyzeWhenAppliedToNotEqualConstraintForStrings()
{
Expand All @@ -62,6 +67,7 @@ public void AnalyzeWhenAppliedToNotEqualConstraintForStrings()

RoslynAssert.Diagnostics(analyzer, expectedDiagnostic, testCode);
}
#endif

[Test]
public void AnalyzeWhenAppliedToEqualityConstraintForArraysOfValidTypes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public void VerifyGetFixableDiagnosticIds()
Assert.That(ids, Is.EquivalentTo(new[] { AnalyzerIdentifiers.WithinIncompatibleTypes }));
}

#if !NUNIT4
[TestCase(NUnitFrameworkConstants.NameOfIsEqualTo)]
#endif
[TestCase(NUnitFrameworkConstants.NameOfIsLessThan)]
[TestCase(NUnitFrameworkConstants.NameOfIsLessThanOrEqualTo)]
[TestCase(NUnitFrameworkConstants.NameOfIsGreaterThan)]
Expand All @@ -39,7 +41,9 @@ public void FixesWithinUsageOnConstraintWithIncompatibleExpectedType(string cons
fixTitle: WithinUsageCodeFix.RemoveWithinDescription);
}

#if !NUNIT4
[TestCase(NUnitFrameworkConstants.NameOfIsEqualTo)]
#endif
[TestCase(NUnitFrameworkConstants.NameOfIsLessThan)]
[TestCase(NUnitFrameworkConstants.NameOfIsLessThanOrEqualTo)]
[TestCase(NUnitFrameworkConstants.NameOfIsGreaterThan)]
Expand All @@ -56,6 +60,7 @@ public void FixesWithinUsageOnInversedConstraintWithIncompatibleExpectedType(str
fixTitle: WithinUsageCodeFix.RemoveWithinDescription);
}

#if !NUNIT4
[Test]
public void FixesWithinUsageOnConstraintWithIncompatibleExpectedTypeWithMessage()
{
Expand All @@ -81,5 +86,6 @@ public void FixesWithinUsageOnConstraintWithIncompatibleExpectedTypeWithMessageA
RoslynAssert.CodeFix(analyzer, fix, expectedDiagnostic, code, fixedCode,
fixTitle: WithinUsageCodeFix.RemoveWithinDescription);
}
#endif
}
}

0 comments on commit d73461a

Please sign in to comment.