New: FluentAssertions to 5.9.0

pull/1689/head
Qstick 5 years ago
parent 1f9bb57ec2
commit 041e28fbb9

@ -35,7 +35,7 @@ namespace NzbDrone.Common.Test.Http
var httpheader = new HttpHeader(headers);
Action action = () => httpheader.GetEncodingFromContentType();
action.ShouldThrow<ArgumentException>();
action.Should().Throw<ArgumentException>();
}
[Test]

@ -64,7 +64,7 @@ namespace NzbDrone.Core.Test.Datastore
Subject.Insert(_basicType);
var storeObject = Subject.Get(_basicType.Id);
storeObject.ShouldBeEquivalentTo(_basicType, o=>o.IncludingAllRuntimeProperties());
storeObject.Should().BeEquivalentTo(_basicType, o=>o.IncludingAllRuntimeProperties());
}
[Test]

@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.Datastore
var loadedAlbum = Db.Single<AlbumRelease>().Album.Value;
loadedAlbum.Should().NotBeNull();
loadedAlbum.ShouldBeEquivalentTo(album,
loadedAlbum.Should().BeEquivalentTo(album,
options => options
.IncludingAllRuntimeProperties()
.Excluding(c => c.Artist)

@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.Datastore.Migration
{
var artists = db.Query("SELECT Artists.* from Artists");
artists.Select(x => x["Id"]).ShouldBeEquivalentTo(ids);
artists.Select(x => x["Id"]).Should().BeEquivalentTo(ids);
var duplicates = artists.GroupBy(x => x["ArtistMetadataId"])
.Where(x => x.Count() > 1);

@ -118,7 +118,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
var detection2 = Subject.GetParser(_indexerSettings1);
detection1.ShouldBeEquivalentTo(detection2);
detection1.Should().BeEquivalentTo(detection2);
VerifyDetectionCount(1);
}

@ -37,7 +37,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
var settings = Subject.Detect(_indexerSettings);
settings.ShouldBeEquivalentTo(new TorrentRssIndexerParserSettings
settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
{
UseEZTVFormat = true,
UseEnclosureUrl = false,
@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
var settings = Subject.Detect(_indexerSettings);
settings.ShouldBeEquivalentTo(new TorrentRssIndexerParserSettings
settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
{
UseEZTVFormat = false,
UseEnclosureUrl = false,
@ -73,7 +73,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
var settings = Subject.Detect(_indexerSettings);
settings.ShouldBeEquivalentTo(new TorrentRssIndexerParserSettings
settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
{
UseEZTVFormat = false,
UseEnclosureUrl = false,
@ -93,7 +93,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
var settings = Subject.Detect(_indexerSettings);
settings.ShouldBeEquivalentTo(new TorrentRssIndexerParserSettings
settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
{
UseEZTVFormat = false,
UseEnclosureUrl = true,
@ -111,7 +111,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
var settings = Subject.Detect(_indexerSettings);
settings.ShouldBeEquivalentTo(new TorrentRssIndexerParserSettings
settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
{
UseEZTVFormat = false,
UseEnclosureUrl = true,
@ -129,7 +129,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
var settings = Subject.Detect(_indexerSettings);
settings.ShouldBeEquivalentTo(new TorrentRssIndexerParserSettings
settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
{
UseEZTVFormat = false,
UseEnclosureUrl = false,
@ -149,7 +149,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
var settings = Subject.Detect(_indexerSettings);
settings.ShouldBeEquivalentTo(new TorrentRssIndexerParserSettings
settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
{
UseEZTVFormat = false,
UseEnclosureUrl = true,
@ -169,7 +169,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
var settings = Subject.Detect(_indexerSettings);
settings.ShouldBeEquivalentTo(new TorrentRssIndexerParserSettings
settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
{
UseEZTVFormat = false,
UseEnclosureUrl = true,
@ -189,7 +189,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
var settings = Subject.Detect(_indexerSettings);
settings.ShouldBeEquivalentTo(new TorrentRssIndexerParserSettings
settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
{
UseEZTVFormat = false,
UseEnclosureUrl = true,
@ -209,7 +209,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
var settings = Subject.Detect(_indexerSettings);
settings.ShouldBeEquivalentTo(new TorrentRssIndexerParserSettings
settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
{
UseEZTVFormat = false,
UseEnclosureUrl = false,
@ -242,7 +242,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
var settings = Subject.Detect(_indexerSettings);
settings.ShouldBeEquivalentTo(new TorrentRssIndexerParserSettings
settings.Should().BeEquivalentTo(new TorrentRssIndexerParserSettings
{
UseEZTVFormat = false,
UseEnclosureUrl = true,

@ -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]

@ -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) }
);
}

@ -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);
}
}
}

@ -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();
}
}

@ -137,7 +137,7 @@ namespace NzbDrone.Core.Test.MusicTests.ArtistRepositoryTests
_artistRepo.Insert(artist1);
Action insertDupe = () => _artistRepo.Insert(artist2);
insertDupe.ShouldThrow<SQLiteException>();
insertDupe.Should().Throw<SQLiteException>();
}
}
}

@ -23,7 +23,7 @@ namespace NzbDrone.Core.Test.ThingiProviderTests
var storedSetting = (NewznabSettings)storedProvider.Settings;
storedSetting.ShouldBeEquivalentTo(newznabSettings, o=>o.IncludingAllRuntimeProperties());
storedSetting.Should().BeEquivalentTo(newznabSettings, o=>o.IncludingAllRuntimeProperties());
}
}
}

@ -22,7 +22,7 @@ namespace NzbDrone.Libraries.Test.JsonTests
var quality = new TypeWithNumbers { Int32 = int.MaxValue, Int64 = long.MaxValue, nullableWithValue = 12 };
var result = Json.Deserialize<TypeWithNumbers>(quality.ToJson());
result.ShouldBeEquivalentTo(quality, o => o.IncludingAllRuntimeProperties());
result.Should().BeEquivalentTo(quality, o => o.IncludingAllRuntimeProperties());
}
}
}

@ -4,7 +4,7 @@
<Platforms>x86</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="4.19.0" />
<PackageReference Include="FluentAssertions" Version="5.9.0" />
<PackageReference Include="FluentValidation" Version="8.4.0" />
<PackageReference Include="Moq" Version="4.13.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />

Loading…
Cancel
Save