mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-25 22:36:59 -04:00
New: FluentAssertions to 5.9.0
This commit is contained in:
@@ -14,7 +14,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
{
|
||||
var dist = new Distance();
|
||||
dist.Add("add", 1.0);
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"add", new List<double> { 1.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"add", new List<double> { 1.0 }}} );
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -22,13 +22,13 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
{
|
||||
var dist = new Distance();
|
||||
dist.AddEquality("equality", "ghi", new List<string> { "abc", "def", "ghi" });
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"equality", new List<double> { 0.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"equality", new List<double> { 0.0 }}} );
|
||||
|
||||
dist.AddEquality("equality", "xyz", new List<string> { "abc", "def", "ghi" });
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"equality", new List<double> { 0.0, 1.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"equality", new List<double> { 0.0, 1.0 }}} );
|
||||
|
||||
dist.AddEquality("equality", "abc", new List<string> { "abc", "def", "ghi" });
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"equality", new List<double> { 0.0, 1.0, 0.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"equality", new List<double> { 0.0, 1.0, 0.0 }}} );
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -36,10 +36,10 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
{
|
||||
var dist = new Distance();
|
||||
dist.AddBool("expr", true);
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"expr", new List<double> { 1.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"expr", new List<double> { 1.0 }}} );
|
||||
|
||||
dist.AddBool("expr", false);
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"expr", new List<double> { 1.0, 0.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"expr", new List<double> { 1.0, 0.0 }}} );
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -47,16 +47,16 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
{
|
||||
var dist = new Distance();
|
||||
dist.AddNumber("number", 1, 1);
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"number", new List<double> { 0.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"number", new List<double> { 0.0 }}} );
|
||||
|
||||
dist.AddNumber("number", 1, 2);
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"number", new List<double> { 0.0, 1.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"number", new List<double> { 0.0, 1.0 }}} );
|
||||
|
||||
dist.AddNumber("number", 2, 1);
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"number", new List<double> { 0.0, 1.0, 1.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"number", new List<double> { 0.0, 1.0, 1.0 }}} );
|
||||
|
||||
dist.AddNumber("number", -1, 2);
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"number", new List<double> { 0.0, 1.0, 1.0, 1.0, 1.0, 1.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"number", new List<double> { 0.0, 1.0, 1.0, 1.0, 1.0, 1.0 }}} );
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -64,13 +64,13 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
{
|
||||
var dist = new Distance();
|
||||
dist.AddPriority("priority", "abc", new List<string> { "abc" });
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0 }}} );
|
||||
|
||||
dist.AddPriority("priority", "def", new List<string> { "abc", "def" });
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0, 0.5 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0, 0.5 }}} );
|
||||
|
||||
dist.AddPriority("priority", "xyz", new List<string> { "abc", "def" });
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0, 0.5, 1.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0, 0.5, 1.0 }}} );
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -78,16 +78,16 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
{
|
||||
var dist = new Distance();
|
||||
dist.AddPriority("priority", new List<string> { "abc" }, new List<string> { "abc" });
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0 }}} );
|
||||
|
||||
dist.AddPriority("priority", new List<string> { "def" }, new List<string> { "abc" });
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0, 1.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0, 1.0 }}} );
|
||||
|
||||
dist.AddPriority("priority", new List<string> { "abc", "xyz" }, new List<string> { "abc" });
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0, 1.0, 0.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0, 1.0, 0.0 }}} );
|
||||
|
||||
dist.AddPriority("priority", new List<string> { "def", "xyz" }, new List<string> { "abc", "def" });
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0, 1.0, 0.0, 0.5 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"priority", new List<double> { 0.0, 1.0, 0.0, 0.5 }}} );
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -95,16 +95,16 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
{
|
||||
var dist = new Distance();
|
||||
dist.AddRatio("ratio", 25, 100);
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"ratio", new List<double> { 0.25 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"ratio", new List<double> { 0.25 }}} );
|
||||
|
||||
dist.AddRatio("ratio", 10, 5);
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"ratio", new List<double> { 0.25, 1.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"ratio", new List<double> { 0.25, 1.0 }}} );
|
||||
|
||||
dist.AddRatio("ratio", -5, 5);
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"ratio", new List<double> { 0.25, 1.0, 0.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"ratio", new List<double> { 0.25, 1.0, 0.0 }}} );
|
||||
|
||||
dist.AddRatio("ratio", 5, 0);
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"ratio", new List<double> { 0.25, 1.0, 0.0, 0.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"ratio", new List<double> { 0.25, 1.0, 0.0, 0.0 }}} );
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -112,7 +112,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
{
|
||||
var dist = new Distance();
|
||||
dist.AddString("string", "abcd", "bcde");
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"string", new List<double> { 0.5 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"string", new List<double> { 0.5 }}} );
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -120,7 +120,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
{
|
||||
var dist = new Distance();
|
||||
dist.AddString("string", string.Empty, "bcd");
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"string", new List<double> { 1.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"string", new List<double> { 1.0 }}} );
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -128,7 +128,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
{
|
||||
var dist = new Distance();
|
||||
dist.AddString("string", string.Empty, string.Empty);
|
||||
dist.Penalties.ShouldBeEquivalentTo(new Dictionary<string, List<double>> { {"string", new List<double> { 0.0 }}} );
|
||||
dist.Penalties.Should().BeEquivalentTo(new Dictionary<string, List<double>> { {"string", new List<double> { 0.0 }}} );
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
+3
-3
@@ -122,7 +122,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
|
||||
var local = GivenLocalAlbumRelease();
|
||||
|
||||
Subject.GetCandidatesFromFingerprint(local, null, null, null, false).ShouldBeEquivalentTo(new List<CandidateAlbumRelease>());
|
||||
Subject.GetCandidatesFromFingerprint(local, null, null, null, false).Should().BeEquivalentTo(new List<CandidateAlbumRelease>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -133,7 +133,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
var localTracks = GivenLocalTracks(tracks, release);
|
||||
var localAlbumRelease = new LocalAlbumRelease(localTracks);
|
||||
|
||||
Subject.GetCandidatesFromTags(localAlbumRelease, null, null, release, false).ShouldBeEquivalentTo(
|
||||
Subject.GetCandidatesFromTags(localAlbumRelease, null, null, release, false).Should().BeEquivalentTo(
|
||||
new List<CandidateAlbumRelease> { new CandidateAlbumRelease(release) }
|
||||
);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
.Setup(x => x.GetReleaseByForeignReleaseId("xxx", true))
|
||||
.Returns(release);
|
||||
|
||||
Subject.GetCandidatesFromTags(localAlbumRelease, null, null, null, false).ShouldBeEquivalentTo(
|
||||
Subject.GetCandidatesFromTags(localAlbumRelease, null, null, null, false).Should().BeEquivalentTo(
|
||||
new List<CandidateAlbumRelease> { new CandidateAlbumRelease(release) }
|
||||
);
|
||||
}
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
TestLogger.Debug($"Found releases:\n{result.Where(x => x.AlbumRelease != null).Select(x => x.AlbumRelease?.ForeignReleaseId).ToJson()}");
|
||||
|
||||
result.Should().HaveCount(testcase.ExpectedMusicBrainzReleaseIds.Count);
|
||||
result.Where(x => x.AlbumRelease != null).Select(x => x.AlbumRelease.ForeignReleaseId).ShouldBeEquivalentTo(testcase.ExpectedMusicBrainzReleaseIds);
|
||||
result.Where(x => x.AlbumRelease != null).Select(x => x.AlbumRelease.ForeignReleaseId).Should().BeEquivalentTo(testcase.ExpectedMusicBrainzReleaseIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -301,7 +301,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
output.Count.Should().Be(100);
|
||||
output.Select(x => x.LocalTracks.Count).Distinct().ShouldBeEquivalentTo(new List<int> { 10 });
|
||||
output.Select(x => x.LocalTracks.Count).Distinct().Should().BeEquivalentTo(new List<int> { 10 });
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
|
||||
result.Mapping
|
||||
.ToDictionary(x => x.Key, y => y.Value.Item1)
|
||||
.ShouldBeEquivalentTo(new Dictionary<LocalTrack, Track> {
|
||||
.Should().BeEquivalentTo(new Dictionary<LocalTrack, Track> {
|
||||
{localTracks[0], tracks[0]},
|
||||
{localTracks[1], tracks[2]},
|
||||
{localTracks[2], tracks[1]},
|
||||
@@ -135,7 +135,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
|
||||
result.Mapping
|
||||
.ToDictionary(x => x.Key, y => y.Value.Item1)
|
||||
.ShouldBeEquivalentTo(new Dictionary<LocalTrack, Track> {
|
||||
.Should().BeEquivalentTo(new Dictionary<LocalTrack, Track> {
|
||||
{localTracks[0], tracks[0]},
|
||||
{localTracks[1], tracks[1]},
|
||||
{localTracks[2], tracks[2]},
|
||||
@@ -156,12 +156,12 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
|
||||
result.Mapping
|
||||
.ToDictionary(x => x.Key, y => y.Value.Item1)
|
||||
.ShouldBeEquivalentTo(new Dictionary<LocalTrack, Track> {
|
||||
.Should().BeEquivalentTo(new Dictionary<LocalTrack, Track> {
|
||||
{localTracks[0], tracks[0]},
|
||||
{localTracks[1], tracks[2]}
|
||||
});
|
||||
result.LocalExtra.Should().BeEmpty();
|
||||
result.MBExtra.ShouldBeEquivalentTo(new List<Track> { tracks[1] });
|
||||
result.MBExtra.Should().BeEquivalentTo(new List<Track> { tracks[1] });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -176,11 +176,11 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
|
||||
result.Mapping
|
||||
.ToDictionary(x => x.Key, y => y.Value.Item1)
|
||||
.ShouldBeEquivalentTo(new Dictionary<LocalTrack, Track> {
|
||||
.Should().BeEquivalentTo(new Dictionary<LocalTrack, Track> {
|
||||
{localTracks[0], tracks[0]},
|
||||
{localTracks[2], tracks[1]}
|
||||
});
|
||||
result.LocalExtra.ShouldBeEquivalentTo(new List<LocalTrack> { localTracks[1] });
|
||||
result.LocalExtra.Should().BeEquivalentTo(new List<LocalTrack> { localTracks[1] });
|
||||
result.MBExtra.Should().BeEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user