Update FluentAssertions

(cherry picked from commit 951a9ade00d7c9105f03608cb598450d706b826f)
pull/1822/head
Stepan Goremykin 1 year ago committed by Bogdan
parent 26afcb0071
commit 1e4c67dcdb

@ -49,7 +49,7 @@ namespace NzbDrone.Common.Test.DiskTests
.Setup(s => s.GetDirectoryInfos(It.IsAny<string>())) .Setup(s => s.GetDirectoryInfos(It.IsAny<string>()))
.Returns(_folders); .Returns(_folders);
Subject.LookupContents(root, false, false).Directories.Should().NotContain(Path.Combine(root, RECYCLING_BIN)); Subject.LookupContents(root, false, false).Directories.Should().NotContain(dir => dir.Path == Path.Combine(root, RECYCLING_BIN));
} }
[Test] [Test]
@ -62,7 +62,7 @@ namespace NzbDrone.Common.Test.DiskTests
.Setup(s => s.GetDirectoryInfos(It.IsAny<string>())) .Setup(s => s.GetDirectoryInfos(It.IsAny<string>()))
.Returns(_folders); .Returns(_folders);
Subject.LookupContents(root, false, false).Directories.Should().NotContain(Path.Combine(root, SYSTEM_VOLUME_INFORMATION)); Subject.LookupContents(root, false, false).Directories.Should().NotContain(dir => dir.Path == Path.Combine(root, SYSTEM_VOLUME_INFORMATION));
} }
[Test] [Test]

@ -564,7 +564,7 @@ namespace NzbDrone.Common.Test.DiskTests
var count = Subject.MirrorFolder(source.FullName, destination.FullName); var count = Subject.MirrorFolder(source.FullName, destination.FullName);
count.Should().Equals(0); count.Should().Be(0);
destination.GetFileSystemInfos().Should().BeEmpty(); destination.GetFileSystemInfos().Should().BeEmpty();
} }
@ -584,7 +584,7 @@ namespace NzbDrone.Common.Test.DiskTests
var count = Subject.MirrorFolder(source.FullName, destination.FullName); var count = Subject.MirrorFolder(source.FullName, destination.FullName);
count.Should().Equals(0); count.Should().Be(0);
destination.GetFileSystemInfos().Should().HaveCount(1); destination.GetFileSystemInfos().Should().HaveCount(1);
} }
@ -601,7 +601,7 @@ namespace NzbDrone.Common.Test.DiskTests
var count = Subject.MirrorFolder(source.FullName, destination.FullName); var count = Subject.MirrorFolder(source.FullName, destination.FullName);
count.Should().Equals(3); count.Should().Be(3);
VerifyCopyFolder(original.FullName, destination.FullName); VerifyCopyFolder(original.FullName, destination.FullName);
} }
@ -618,7 +618,7 @@ namespace NzbDrone.Common.Test.DiskTests
var count = Subject.MirrorFolder(source.FullName, destination.FullName); var count = Subject.MirrorFolder(source.FullName, destination.FullName);
count.Should().Equals(3); count.Should().Be(3);
File.Exists(Path.Combine(destination.FullName, _nfsFile)).Should().BeFalse(); File.Exists(Path.Combine(destination.FullName, _nfsFile)).Should().BeFalse();
} }
@ -638,7 +638,7 @@ namespace NzbDrone.Common.Test.DiskTests
var count = Subject.MirrorFolder(source.FullName, destination.FullName); var count = Subject.MirrorFolder(source.FullName, destination.FullName);
count.Should().Equals(0); count.Should().Be(0);
VerifyCopyFolder(original.FullName, destination.FullName); VerifyCopyFolder(original.FullName, destination.FullName);
} }
@ -655,7 +655,7 @@ namespace NzbDrone.Common.Test.DiskTests
var count = Subject.MirrorFolder(source.FullName + Path.DirectorySeparatorChar, destination.FullName); var count = Subject.MirrorFolder(source.FullName + Path.DirectorySeparatorChar, destination.FullName);
count.Should().Equals(3); count.Should().Be(3);
VerifyCopyFolder(original.FullName, destination.FullName); VerifyCopyFolder(original.FullName, destination.FullName);
} }

@ -13,6 +13,7 @@ namespace NzbDrone.Core.Test.Datastore
[TestFixture] [TestFixture]
public class BasicRepositoryFixture : DbTest<BasicRepository<ScheduledTask>, ScheduledTask> public class BasicRepositoryFixture : DbTest<BasicRepository<ScheduledTask>, ScheduledTask>
{ {
private readonly TimeSpan _dateTimePrecision = TimeSpan.FromMilliseconds(20);
private List<ScheduledTask> _basicList; private List<ScheduledTask> _basicList;
[SetUp] [SetUp]
@ -20,7 +21,7 @@ namespace NzbDrone.Core.Test.Datastore
{ {
AssertionOptions.AssertEquivalencyUsing(options => AssertionOptions.AssertEquivalencyUsing(options =>
{ {
options.Using<DateTime>(ctx => ctx.Subject.Should().BeCloseTo(ctx.Expectation.ToUniversalTime())).WhenTypeIs<DateTime>(); options.Using<DateTime>(ctx => ctx.Subject.Should().BeCloseTo(ctx.Expectation.ToUniversalTime(), _dateTimePrecision)).WhenTypeIs<DateTime>();
return options; return options;
}); });

@ -42,7 +42,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
Subject.Clean(); Subject.Clean();
// BeCloseTo handles Postgres rounding times // BeCloseTo handles Postgres rounding times
AllStoredModels.ToList().ForEach(t => t.LastExecution.Should().BeCloseTo(expectedTime)); AllStoredModels.ToList().ForEach(t => t.LastExecution.Should().BeCloseTo(expectedTime, TimeSpan.FromMilliseconds(20)));
} }
} }
} }

@ -34,6 +34,7 @@ namespace NzbDrone.Core.Test.ThingiProviderTests
public class ProviderStatusServiceFixture : CoreTest<MockProviderStatusService> public class ProviderStatusServiceFixture : CoreTest<MockProviderStatusService>
{ {
private readonly TimeSpan _disabledTillPrecision = TimeSpan.FromMilliseconds(500);
private DateTime _epoch; private DateTime _epoch;
[SetUp] [SetUp]
@ -90,7 +91,7 @@ namespace NzbDrone.Core.Test.ThingiProviderTests
var status = Subject.GetBlockedProviders().FirstOrDefault(); var status = Subject.GetBlockedProviders().FirstOrDefault();
status.Should().NotBeNull(); status.Should().NotBeNull();
status.DisabledTill.Should().HaveValue(); status.DisabledTill.Should().HaveValue();
status.DisabledTill.Value.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(1), 500); status.DisabledTill.Value.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(1), _disabledTillPrecision);
} }
[Test] [Test]
@ -133,7 +134,7 @@ namespace NzbDrone.Core.Test.ThingiProviderTests
var status = Subject.GetBlockedProviders().FirstOrDefault(); var status = Subject.GetBlockedProviders().FirstOrDefault();
status.Should().NotBeNull(); status.Should().NotBeNull();
status.DisabledTill.Should().HaveValue(); status.DisabledTill.Should().HaveValue();
status.DisabledTill.Value.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(5), 500); status.DisabledTill.Value.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(5), _disabledTillPrecision);
} }
[Test] [Test]
@ -160,7 +161,7 @@ namespace NzbDrone.Core.Test.ThingiProviderTests
status.Should().NotBeNull(); status.Should().NotBeNull();
origStatus.EscalationLevel.Should().Be(3); origStatus.EscalationLevel.Should().Be(3);
status.DisabledTill.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(1), 500); status.DisabledTill.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(1), _disabledTillPrecision);
} }
} }
} }

@ -3,7 +3,7 @@
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3" /> <PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="FluentValidation" Version="9.5.4" /> <PackageReference Include="FluentValidation" Version="9.5.4" />
<PackageReference Include="Moq" Version="4.17.2" /> <PackageReference Include="Moq" Version="4.17.2" />
<PackageReference Include="NLog" Version="5.2.0" /> <PackageReference Include="NLog" Version="5.2.0" />

Loading…
Cancel
Save