From bb9cbd3e66ecc3306ea6e2ca9d6e39bc51b9135e Mon Sep 17 00:00:00 2001 From: Naxesss <30292137+Naxesss@users.noreply.github.com> Date: Tue, 12 Oct 2021 00:35:58 +0200 Subject: [PATCH] Undo disposal of `Stream` for use in mocking Because the Stream object is accessed when the mocked object calls `GetStream`, we cannot close it here. The resource should be released upon teardown anyway. --- osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs | 2 +- osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs b/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs index eb35fa1d0f..04baf7d854 100644 --- a/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs @@ -83,7 +83,7 @@ namespace osu.Game.Tests.Editing.Checks private BeatmapVerifierContext getContext(string resourceName, bool allowMissing = false) { - using Stream resourceStream = string.IsNullOrEmpty(resourceName) ? null : TestResources.OpenResource(resourceName); + Stream resourceStream = string.IsNullOrEmpty(resourceName) ? null : TestResources.OpenResource(resourceName); if (!allowMissing && resourceStream == null) throw new FileNotFoundException($"The requested test resource \"{resourceName}\" does not exist."); diff --git a/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs b/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs index e95665156f..e978af5e49 100644 --- a/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs @@ -104,7 +104,7 @@ namespace osu.Game.Tests.Editing.Checks private BeatmapVerifierContext getContext(string resourceName, bool allowMissing = false) { - using Stream resourceStream = string.IsNullOrEmpty(resourceName) ? null : TestResources.OpenResource(resourceName); + Stream resourceStream = string.IsNullOrEmpty(resourceName) ? null : TestResources.OpenResource(resourceName); if (!allowMissing && resourceStream == null) throw new FileNotFoundException($"The requested test resource \"{resourceName}\" does not exist.");