mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-27 01:57:21 +00:00
Added MassEdit for series editing.
This commit is contained in:
parent
906b5d12cd
commit
e885fadc59
6 changed files with 303 additions and 0 deletions
|
@ -706,5 +706,80 @@ public void SearchForSeries_should_return_results_when_query_has_special_charact
|
|||
//Assert
|
||||
series.Should().HaveCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UpdateFromMassEdit_should_only_update_certain_values()
|
||||
{
|
||||
WithRealDb();
|
||||
var newQualityProfileId = 10;
|
||||
var newMonitored = false;
|
||||
var newSeasonFolder = false;
|
||||
|
||||
var fakeQuality = Builder<QualityProfile>.CreateNew().Build();
|
||||
var fakeSeries = Builder<Series>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(e => e.QualityProfileId = fakeQuality.QualityProfileId)
|
||||
.With(e => e.Monitored = true)
|
||||
.With(e => e.SeasonFolder = true)
|
||||
.With(s => s.Title = "It's Always Sunny")
|
||||
.Build();
|
||||
|
||||
Db.InsertMany(fakeSeries);
|
||||
Db.Insert(fakeQuality);
|
||||
|
||||
fakeSeries[0].QualityProfileId = newQualityProfileId;
|
||||
fakeSeries[0].Monitored = newMonitored;
|
||||
fakeSeries[0].SeasonFolder = newSeasonFolder;
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<SeriesProvider>().UpdateFromMassEdit(fakeSeries);
|
||||
|
||||
//Assert
|
||||
var result = Db.Fetch<Series>();
|
||||
result.Count.Should().Be(1);
|
||||
result.First().QualityProfileId.Should().Be(newQualityProfileId);
|
||||
result.First().Monitored.Should().Be(newMonitored);
|
||||
result.First().SeasonFolder.Should().Be(newSeasonFolder);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UpdateFromMassEdit_should_only_update_changed_values()
|
||||
{
|
||||
WithRealDb();
|
||||
var newQualityProfileId = 10;
|
||||
var newMonitored = false;
|
||||
var newSeasonFolder = false;
|
||||
var monitored = true;
|
||||
var seasonFolder = true;
|
||||
|
||||
var fakeQuality = Builder<QualityProfile>.CreateNew().Build();
|
||||
var fakeSeries = Builder<Series>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(e => e.QualityProfileId = fakeQuality.QualityProfileId)
|
||||
.With(e => e.Monitored = monitored)
|
||||
.With(e => e.SeasonFolder = seasonFolder)
|
||||
.With(s => s.Title = "It's Always Sunny")
|
||||
.Build();
|
||||
|
||||
Db.InsertMany(fakeSeries);
|
||||
Db.Insert(fakeQuality);
|
||||
|
||||
fakeSeries[0].QualityProfileId = newQualityProfileId;
|
||||
fakeSeries[0].Monitored = newMonitored;
|
||||
fakeSeries[0].SeasonFolder = newSeasonFolder;
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<SeriesProvider>().UpdateFromMassEdit(fakeSeries);
|
||||
|
||||
//Assert
|
||||
var result = Db.Fetch<Series>();
|
||||
result.Count.Should().Be(2);
|
||||
result.First().QualityProfileId.Should().Be(newQualityProfileId);
|
||||
result.First().Monitored.Should().Be(newMonitored);
|
||||
result.First().SeasonFolder.Should().Be(newSeasonFolder);
|
||||
result.Last().QualityProfileId.Should().Be(fakeQuality.QualityProfileId);
|
||||
result.Last().Monitored.Should().Be(monitored);
|
||||
result.Last().SeasonFolder.Should().Be(seasonFolder);
|
||||
}
|
||||
}
|
||||
} |