Skip to content

Commit

Permalink
Rewrite some legacy tests (#385)
Browse files Browse the repository at this point in the history
* Disallow NUnit2005 and NUnit2033 violations except for legacy tests.
  • Loading branch information
Corniel committed Apr 19, 2024
1 parent 247c186 commit 6d3a6b0
Show file tree
Hide file tree
Showing 27 changed files with 754 additions and 912 deletions.
6 changes: 3 additions & 3 deletions .editorconfig
Expand Up @@ -51,8 +51,8 @@ dotnet_diagnostic.FAA0004.severity = error # Replace NUnit assertion with Fluen
dotnet_diagnostic.NUnit1001.severity = none # The individual arguments provided by a TestCaseAttribute must match the type of the corresponding parameter of the method
dotnet_diagnostic.NUnit2005.severity = suggestion # Consider using Assert.That(actual, Is.EqualTo(expected)) instead of Assert.AreEqual(expected, actual)
dotnet_diagnostic.NUnit2021.severity = warning # Incompatible types for EqualTo constraint


dotnet_diagnostic.NUnit2005.severity = error # Consider using Assert.That instead of AreEqual
dotnet_diagnostic.NUnit2033.severity = error # Consider using Assert.That instead of NotZero

dotnet_diagnostic.QW0001.severity = none # Use a testable Time Provider
dotnet_diagnostic.QW0010.severity = none # Use DateOnly instead of Date
Expand Down Expand Up @@ -113,7 +113,6 @@ dotnet_diagnostic.S3925.severity = none # "ISerializable" should be implemented
dotnet_diagnostic.S4136.severity = none # Method overloads should be grouped together

dotnet_diagnostic.S1133.severity = suggestion # Deprecated code should be removed
dotnet_diagnostic.S3900.severity = suggestion # Arguments of public methods should be validated against null

dotnet_diagnostic.S107.severity = warning # Methods should not have too many parameters
dotnet_diagnostic.S127.severity = warning # Methods should not have too many parameters
Expand All @@ -136,6 +135,7 @@ dotnet_diagnostic.S3215.severity = warning # Interface instances should not be c
dotnet_diagnostic.S3218.severity = warning # Inner class members should not shadow outer class "static" or type members
dotnet_diagnostic.S3257.severity = warning # Declarations and initializations should be as concise as possible
dotnet_diagnostic.S3776.severity = warning # Cognitive Complexity of methods should not be too high
dotnet_diagnostic.S3900.severity = warning # Arguments of public methods should be validated against null
dotnet_diagnostic.S6354.severity = warning # Use a testable (date) time provider instead

dotnet_diagnostic.VSSpell001.severity = silent # Correct spelling
14 changes: 13 additions & 1 deletion specs/Qowaiv.Specs/Date_span_specs.cs
@@ -1,4 +1,6 @@
namespace Date_span_specs;
using FluentAssertions.Extensions;

namespace Date_span_specs;

public class Is_comparable
{
Expand Down Expand Up @@ -141,6 +143,16 @@ public void plus_does_nothing()
}
}

public class Can_be_added_to
{
[Test]
public void Date_times()
{
var date = 30.January(1999).At(13, 42).AsUtc();
date.Add(DateSpan.FromMonths(1)).Should().Be(28.February(1999).At(13, 42).AsUtc());
}
}

public class Can_create
{
[Test]
Expand Down
2 changes: 1 addition & 1 deletion specs/Qowaiv.Specs/Debug_SVO_specs.cs
Expand Up @@ -42,7 +42,7 @@ public void display(Type svoType, object display)
public class Unknown_value : SingleValueObjectSpecs
{
public static IEnumerable<Type> SvosWithDefaultUnknown
=> SvosWithUnknown.Except(new[] { typeof(Sex), typeof(InternetMediaType) });
=> SvosWithUnknown.Except([typeof(Sex), typeof(InternetMediaType)]);

[TestCaseSource(nameof(SvosWithDefaultUnknown))]
public void displays_unknown_for(Type svoType)
Expand Down

0 comments on commit 6d3a6b0

Please sign in to comment.