Skip to content

Commit

Permalink
Update package dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianEdwards committed Apr 20, 2024
1 parent a52b2ab commit f2159fd
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 78 deletions.
18 changes: 9 additions & 9 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="PolySharp" Version="1.13.2" />
<PackageVersion Include="PolySharp" Version="1.14.1" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="coverlet.collector" Version="3.2.0" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.2" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="xunit" Version="2.7.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.8" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
</ItemGroup>
</Project>
60 changes: 30 additions & 30 deletions tests/MiniValidation.UnitTests/Recursion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void Invalid_When_Child_Invalid_And_Recurse_Default()
var result = MiniValidator.TryValidate(thingToValidate, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
}

[Fact]
Expand All @@ -48,7 +48,7 @@ public void Valid_When_Child_Invalid_And_Recurse_False()
var result = MiniValidator.TryValidate(thingToValidate, recurse: false, out var errors);

Assert.True(result);
Assert.Equal(0, errors.Count);
Assert.Empty(errors);
}

[Fact]
Expand All @@ -59,7 +59,7 @@ public void Valid_When_Child_Invalid_And_Property_Decorated_With_SkipRecursion()
var result = MiniValidator.TryValidate(thingToValidate, recurse: false, out var errors);

Assert.True(result);
Assert.Equal(0, errors.Count);
Assert.Empty(errors);
}

[Fact]
Expand Down Expand Up @@ -117,11 +117,11 @@ public void Error_Message_Keys_For_Descendants_Are_Formatted_Correctly(int maxDe
var result = MiniValidator.TryValidate(thingToValidate, recurse: true, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Single(errors);

var messagePrefix = string.Concat(Enumerable.Repeat($"{nameof(TestType.Child)}.", maxDepth + 1));
Assert.Collection(errors,
entry => Assert.Equal($"{messagePrefix}{nameof(TestChildType.RequiredCategory)}", entry.Key));
var entry = Assert.Single(errors);
Assert.Equal($"{messagePrefix}{nameof(TestChildType.RequiredCategory)}", entry.Key);
}

[Fact]
Expand Down Expand Up @@ -152,9 +152,9 @@ public void Error_Message_Keys_For_Descendant_Enumerable_Are_Formatted_Correctly
var result = MiniValidator.TryValidate(thingToValidate, recurse: true, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Collection(errors,
entry => Assert.Equal($"{nameof(TestType.Children)}[1].{nameof(TestChildType.RequiredCategory)}", entry.Key));
Assert.Single(errors);
var entry = Assert.Single(errors);
Assert.Equal($"{nameof(TestType.Children)}[1].{nameof(TestChildType.RequiredCategory)}", entry.Key);
}

[Fact]
Expand All @@ -169,9 +169,9 @@ public void First_Error_In_Root_Enumerable_Returns_Immediately()
var result = MiniValidator.TryValidate(thingToValidate, recurse: true, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Collection(errors,
entry => Assert.Equal($"[0].{nameof(TestType.RequiredName)}", entry.Key));
Assert.Single(errors);
var entry = Assert.Single(errors);
Assert.Equal($"[0].{nameof(TestType.RequiredName)}", entry.Key);
}

[Fact]
Expand All @@ -184,9 +184,9 @@ public void First_Error_In_Descendant_Enumerable_Returns_Immediately()
var result = MiniValidator.TryValidate(thingToValidate, recurse: true, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Collection(errors,
entry => Assert.Equal($"{nameof(TestType.Children)}[0].{nameof(TestChildType.MinLengthFive)}", entry.Key));
Assert.Single(errors);
var entry = Assert.Single(errors);
Assert.Equal($"{nameof(TestType.Children)}[0].{nameof(TestChildType.MinLengthFive)}", entry.Key);
}

[Fact]
Expand Down Expand Up @@ -215,7 +215,7 @@ public void Valid_When_Descendant_Invalid_And_Property_Decorated_With_SkipRecurs
var result = MiniValidator.TryValidate(thingToValidate, recurse: false, out var errors);

Assert.True(result);
Assert.Equal(0, errors.Count);
Assert.Empty(errors);
}

[Fact]
Expand All @@ -226,7 +226,7 @@ public void Invalid_When_Descendant_Invalid_And_Property_Is_Required_And_Decorat
var result = MiniValidator.TryValidate(thingToValidate, recurse: false, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
}

[Fact]
Expand All @@ -237,7 +237,7 @@ public void Invalid_When_Derived_Type_Has_Invalid_Inherited_Property()
var result = MiniValidator.TryValidate(thingToValidate, recurse: true, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
}

[Fact]
Expand All @@ -248,7 +248,7 @@ public void Invalid_When_Derived_Type_Has_Invalid_Own_Property()
var result = MiniValidator.TryValidate(thingToValidate, recurse: true, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
}

[Fact]
Expand All @@ -259,7 +259,7 @@ public void Valid_When_Derived_Type_Has_Invalid_Own_Property_With_Recurse_False(
var result = MiniValidator.TryValidate(thingToValidate, recurse: false, out var errors);

Assert.True(result);
Assert.Equal(0, errors.Count);
Assert.Empty(errors);
}

[Fact]
Expand All @@ -273,7 +273,7 @@ public void Invalid_When_ValidatableObject_Child_Validate_Is_Invalid()
var result = MiniValidator.TryValidate(thingToValidate, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
Assert.Equal($"{nameof(TestValidatableType.ValidatableChild)}.{nameof(TestValidatableType.TwentyOrMore)}", errors.Keys.First());
}

Expand All @@ -288,7 +288,7 @@ public void Invalid_When_Derived_ValidatableObject_Child_Validate_Is_Invalid()
var result = MiniValidator.TryValidate(thingToValidate, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
Assert.Equal($"{nameof(TestValidatableType.Child)}.{nameof(TestValidatableType.TwentyOrMore)}", errors.Keys.First());
}

Expand All @@ -303,7 +303,7 @@ public void Invalid_When_Derived_Polymorphic_Child_Validate_Is_Invalid()
var result = MiniValidator.TryValidate(thingToValidate, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
Assert.Equal($"{nameof(TestValidatableType.Child)}.{nameof(TestValidatableChildType.MinLengthFive)}", errors.Keys.First());
}

Expand Down Expand Up @@ -334,7 +334,7 @@ public void Invalid_When_Derived_ValidatableOnlyChild_Is_Invalid()
var result = MiniValidator.TryValidate(thingToValidate, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
Assert.Equal($"{nameof(TestValidatableType.ValidatableOnlyChild)}.{nameof(TestValidatableOnlyType.TwentyOrMore)}", errors.Keys.First());
}

Expand All @@ -349,7 +349,7 @@ public void Invalid_When_Polymorphic_ValidatableOnlyChild_Is_Invalid()
var result = MiniValidator.TryValidate(thingToValidate, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
Assert.Equal($"{nameof(TestValidatableType.PocoChild)}.{nameof(TestValidatableOnlyType.TwentyOrMore)}", errors.Keys.First());
}

Expand All @@ -364,7 +364,7 @@ public void Invalid_When_Polymorphic_Child_With_Validation_Attributes_Is_Invalid
var result = MiniValidator.TryValidate(thingToValidate, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
Assert.Equal($"{nameof(TestValidatableType.PocoChild)}.{nameof(TestChildType.MinLengthFive)}", errors.Keys.First());
}

Expand Down Expand Up @@ -393,7 +393,7 @@ public async Task Invalid_When_AsyncValidatableOnlyChild_Is_Invalid()
var (isValid, errors) = await MiniValidator.TryValidateAsync(thingToValidate);

Assert.False(isValid);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
Assert.Equal($"{nameof(TestTypeWithAsyncChild.NeedsAsync)}.{nameof(TestAsyncValidatableChildType.TwentyOrMore)}", errors.Keys.First());
}

Expand All @@ -408,7 +408,7 @@ public void Invalid_When_AsyncValidatableOnlyChild_Is_Invalid_Allowing_SyncOverA
var result = MiniValidator.TryValidate(thingToValidate, recurse: true, allowAsync: true, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
Assert.Equal($"{nameof(TestTypeWithAsyncChild.NeedsAsync)}.{nameof(TestAsyncValidatableChildType.TwentyOrMore)}", errors.Keys.First());
}

Expand Down Expand Up @@ -437,7 +437,7 @@ public void Invalid_When_Polymorphic_AsyncValidatableOnlyChild_Is_Invalid_Allowi
var result = MiniValidator.TryValidate(thingToValidate, recurse: true, allowAsync: true, out var errors);

Assert.False(result);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
Assert.Equal($"{nameof(TestValidatableType.PocoChild)}.{nameof(TestValidatableOnlyType.TwentyOrMore)}", errors.Keys.First());
}

Expand All @@ -452,7 +452,7 @@ public async Task Invalid_When_Polymorphic_AsyncValidatableOnlyChild_Is_Invalid(
var (isValid, errors) = await MiniValidator.TryValidateAsync(thingToValidate);

Assert.False(isValid);
Assert.Equal(1, errors.Count);
Assert.Single(errors);
Assert.Equal($"{nameof(TestValidatableType.PocoChild)}.{nameof(TestAsyncValidatableChildType.TwentyOrMore)}", errors.Keys.First());
}
}
Loading

0 comments on commit f2159fd

Please sign in to comment.