From 524ff419314c45bd2526df614cacee75599ae6b9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 10 Jan 2020 12:39:45 +0900 Subject: [PATCH] Add more assertions --- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 47eab01699..4a6e1f1caa 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -616,8 +616,15 @@ namespace osu.Game.Tests.Beatmaps.IO manager.UpdateFile(setToUpdate, fileToUpdate, stream); } - Beatmap updatedBeatmap = (Beatmap)manager.GetWorkingBeatmap(manager.QueryBeatmap(b => b.ID == beatmapToUpdate.BeatmapInfo.ID)).Beatmap; + // Check that the old file has been dereferenced + Assert.That(manager.Files.QueryFiles(f => f.ID == fileToUpdate.FileInfoID).SingleOrDefault(), Is.Null); + // Ensure that the old file is deleted upon a cleanup + manager.Files.Cleanup(); + Assert.That(new System.IO.FileInfo(manager.Files.Storage.GetFullPath(fileToUpdate.FileInfo.StoragePath)), Does.Not.Exist); + + // Check that the new file is referenced correctly by attempting a retrieval + Beatmap updatedBeatmap = (Beatmap)manager.GetWorkingBeatmap(manager.QueryBeatmap(b => b.ID == beatmapToUpdate.BeatmapInfo.ID)).Beatmap; Assert.That(updatedBeatmap.HitObjects.Count, Is.EqualTo(1)); Assert.That(updatedBeatmap.HitObjects[0].StartTime, Is.EqualTo(5000)); }