build: upgrade fluent assertions to v6

Also fix unit tests and compile issues
pull/47/head
Robert Dailey 3 years ago
parent 5a1bfa18bb
commit 06d2222865

@ -5,8 +5,8 @@
<PackageReference Update="Autofac.Extras.AggregateService" Version="6.*" />
<PackageReference Update="AutofacContrib.NSubstitute" Version="7.*" />
<PackageReference Update="CliFx" Version="2.*" />
<PackageReference Update="FluentAssertions" Version="5.*" />
<PackageReference Update="FluentAssertions.Json" Version="5.*" />
<PackageReference Update="FluentAssertions" Version="6.*" />
<PackageReference Update="FluentAssertions.Json" Version="6.*" />
<PackageReference Update="FluentValidation" Version="10.*" />
<PackageReference Update="Flurl" Version="3.*" />
<PackageReference Update="Flurl.Http" Version="3.*" />

@ -6,17 +6,19 @@ namespace TestLibrary.FluentAssertions
{
public class JsonEquivalencyStep : IEquivalencyStep
{
public bool CanHandle(IEquivalencyValidationContext context, IEquivalencyAssertionOptions config)
public EquivalencyResult Handle(Comparands comparands, IEquivalencyValidationContext context,
IEquivalencyValidator nestedValidator)
{
return context.Subject?.GetType().IsAssignableTo(typeof(JToken)) ?? false;
}
var canHandle = comparands.Subject?.GetType().IsAssignableTo(typeof(JToken)) ?? false;
if (!canHandle)
{
return EquivalencyResult.ContinueWithNext;
}
public bool Handle(IEquivalencyValidationContext context, IEquivalencyValidator parent,
IEquivalencyAssertionOptions config)
{
((JToken) context.Subject).Should()
.BeEquivalentTo((JToken) context.Expectation, context.Because, context.BecauseArgs);
return true;
((JToken) comparands.Subject!).Should().BeEquivalentTo(
(JToken) comparands.Expectation, context.Reason.FormattedMessage, context.Reason.Arguments);
return EquivalencyResult.AssertionCompleted;
}
}
}

@ -192,7 +192,7 @@ namespace TrashLib.Tests.Radarr.CustomFormat.Processors.GuideSteps
processor.DuplicatedCustomFormats.Should().BeEmpty();
processor.CustomFormatsWithOutdatedNames.Should().BeEmpty();
processor.DeletedCustomFormatsInCache.Should()
.BeEquivalentTo(new TrashIdMapping("id1000", "name1"));
.BeEquivalentTo(new[] {new TrashIdMapping("id1000", "name1")});
processor.ProcessedCustomFormats.Should().BeEquivalentTo(new List<ProcessedCustomFormatData>
{
new("name1", "id1", JObject.Parse(@"{'name': 'name1'}"))
@ -218,7 +218,7 @@ namespace TrashLib.Tests.Radarr.CustomFormat.Processors.GuideSteps
processor.DuplicatedCustomFormats.Should().BeEmpty();
processor.CustomFormatsWithOutdatedNames.Should().BeEmpty();
processor.DeletedCustomFormatsInCache.Should().BeEquivalentTo(cache.TrashIdMappings[0]);
processor.DeletedCustomFormatsInCache.Should().BeEquivalentTo(new[] {cache.TrashIdMappings[0]});
processor.ProcessedCustomFormats.Should().BeEmpty();
}
@ -269,8 +269,9 @@ namespace TrashLib.Tests.Radarr.CustomFormat.Processors.GuideSteps
processor.Process(guideData, testConfig, null);
//Dictionary<string, List<ProcessedCustomFormatData>>
processor.DuplicatedCustomFormats.Should().ContainKey("name1")
.WhichValue.Should().BeEquivalentTo(new List<ProcessedCustomFormatData>
processor.DuplicatedCustomFormats.Should()
.ContainKey("name1").WhoseValue.Should()
.BeEquivalentTo(new List<ProcessedCustomFormatData>
{
new("name1", "id1", JObject.Parse(@"{'name': 'name1'}")),
new("name1", "id2", JObject.Parse(@"{'name': 'name1'}"))

@ -35,7 +35,7 @@ namespace TrashLib.Tests.Radarr.CustomFormat.Processors.GuideSteps
processor.Process(testConfigData);
processor.ProfileScores.Should().BeEmpty();
processor.CustomFormatsWithoutScore.Should().Equal(new List<object> {("name1", "id1", "profile1")});
processor.CustomFormatsWithoutScore.Should().Equal(("name1", "id1", "profile1"));
}
[Test]
@ -60,7 +60,7 @@ namespace TrashLib.Tests.Radarr.CustomFormat.Processors.GuideSteps
processor.Process(testConfigData);
processor.ProfileScores.Should()
.ContainKey("profile1").WhichValue.Should()
.ContainKey("profile1").WhoseValue.Should()
.BeEquivalentTo(CfTestUtils.NewMapping(new FormatMappingEntry(testConfigData[0].CustomFormats[0], 50)));
processor.CustomFormatsWithoutScore.Should().BeEmpty();
@ -123,7 +123,7 @@ namespace TrashLib.Tests.Radarr.CustomFormat.Processors.GuideSteps
processor.Process(testConfigData);
processor.ProfileScores.Should()
.ContainKey("profile1").WhichValue.Should()
.ContainKey("profile1").WhoseValue.Should()
.BeEquivalentTo(CfTestUtils.NewMapping(new FormatMappingEntry(testConfigData[0].CustomFormats[0], 0)));
processor.CustomFormatsWithoutScore.Should().BeEmpty();

@ -125,7 +125,7 @@ namespace TrashLib.Tests.Radarr.CustomFormat.Processors.PersistenceSteps
processor.InvalidProfileNames.Should().BeEmpty();
processor.UpdatedScores.Should()
.ContainKey("profile1").WhichValue.Should()
.ContainKey("profile1").WhoseValue.Should()
.BeEquivalentTo(new List<UpdatedFormatScore>
{
new("cf1", 0, FormatScoreUpdateReason.Reset),
@ -255,7 +255,7 @@ namespace TrashLib.Tests.Radarr.CustomFormat.Processors.PersistenceSteps
.UpdateQualityProfile(Verify.That<JObject>(a => a.Should().BeEquivalentTo(expectedProfileJson)), 1);
processor.InvalidProfileNames.Should().BeEmpty();
processor.UpdatedScores.Should()
.ContainKey("profile1").WhichValue.Should()
.ContainKey("profile1").WhoseValue.Should()
.BeEquivalentTo(new List<UpdatedFormatScore>
{
new("3D", 100, FormatScoreUpdateReason.Updated),

@ -70,7 +70,7 @@ xyz
var results = context.ParseWithDefaults(markdown);
results.Should().ContainKey("Test Release Profile")
.WhichValue.Should().BeEquivalentTo(new
.WhoseValue.Should().BeEquivalentTo(new
{
Ignored = new List<string> {"abc"},
Required = new List<string> {"xyz"}
@ -107,7 +107,7 @@ One more
var results = context.ParseWithDefaults(markdown);
results.Should().ContainKey("Test Release Profile")
.WhichValue.Should().BeEquivalentTo(new
.WhoseValue.Should().BeEquivalentTo(new
{
Ignored = new List<string> {"abc"},
Required = new List<string> {"xyz", "123"}
@ -127,7 +127,7 @@ One more
profile.Ignored.Should().BeEquivalentTo("term2", "term3");
profile.Required.Should().BeEquivalentTo("term4");
profile.Preferred.Should().ContainKey(100).WhichValue.Should().BeEquivalentTo(new List<string> {"term1"});
profile.Preferred.Should().ContainKey(100).WhoseValue.Should().BeEquivalentTo(new List<string> {"term1"});
}
[Test]
@ -139,10 +139,10 @@ One more
results.Should()
.ContainKey("First Release Profile")
.WhichValue.IncludePreferredWhenRenaming.Should().Be(true);
.WhoseValue.IncludePreferredWhenRenaming.Should().Be(true);
results.Should()
.ContainKey("Second Release Profile")
.WhichValue.IncludePreferredWhenRenaming.Should().Be(false);
.WhoseValue.IncludePreferredWhenRenaming.Should().Be(false);
}
[Test]
@ -307,7 +307,7 @@ abc
results.Should()
.ContainKey("Test Release Profile")
.WhichValue.Preferred.Should()
.WhoseValue.Preferred.Should()
.BeEquivalentTo(new Dictionary<int, List<string>>
{
{100, new List<string> {"abc"}}
@ -356,8 +356,7 @@ abc
var results = context.ParseWithDefaults(markdown);
results.Should()
.ContainKey("Test Release Profile")
.WhichValue.Should()
.ContainKey("Test Release Profile").WhoseValue.Should()
.BeEquivalentTo(new
{
Required = new { },

Loading…
Cancel
Save