mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 17:59:14 +00:00
MediaFileProvider delete fixed to delete EpisodeFile with key of Int32 instead of object Int32. Added test to ensure File is deleted, but others remain.
This commit is contained in:
parent
031fc91c93
commit
9f5b461274
2 changed files with 21 additions and 1 deletions
|
@ -154,5 +154,25 @@ public void CalculateFilePath_SeasonFolder_SingleNumber(string filename, int sea
|
||||||
//Assert
|
//Assert
|
||||||
Assert.AreEqual(expectedPath, result.FullName);
|
Assert.AreEqual(expectedPath, result.FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void DeleteEpisodeFile()
|
||||||
|
{
|
||||||
|
//Setup
|
||||||
|
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(10).Build();
|
||||||
|
|
||||||
|
var mocker = new AutoMoqer();
|
||||||
|
var database = MockLib.GetEmptyDatabase(true);
|
||||||
|
mocker.SetConstant(database);
|
||||||
|
database.InsertMany(episodeFiles);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
mocker.Resolve<MediaFileProvider>().Delete(1);
|
||||||
|
var result = database.Fetch<EpisodeFile>();
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
result.Should().HaveCount(9);
|
||||||
|
result.Should().NotContain(e => e.EpisodeFileId == 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -45,7 +45,7 @@ public virtual void Update(EpisodeFile episodeFile)
|
||||||
|
|
||||||
public virtual void Delete(int episodeFileId)
|
public virtual void Delete(int episodeFileId)
|
||||||
{
|
{
|
||||||
_database.Delete(episodeFileId);
|
_database.Delete<EpisodeFile>(episodeFileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool Exists(string path)
|
public virtual bool Exists(string path)
|
||||||
|
|
Loading…
Reference in a new issue