1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-25 16:12:55 +08:00
osu-lazer/osu.Game.Tests/Resources/TestResources.cs

29 lines
955 B
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
using System.IO;
2019-01-28 17:19:57 +08:00
using NUnit.Framework;
using osu.Framework.IO.Stores;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Tests.Resources
{
2019-01-28 17:19:57 +08:00
public static class TestResources
2018-04-13 17:19:50 +08:00
{
2019-01-28 17:19:57 +08:00
public static Stream OpenResource(string name) => new DllResourceStore("osu.Game.Tests.dll").GetStream($"Resources/{name}");
public static Stream GetTestBeatmapStream() => new DllResourceStore("osu.Game.Resources.dll").GetStream("Beatmaps/241526 Soleily - Renatus.osz");
public static string GetTestBeatmapForImport()
2018-04-13 17:19:50 +08:00
{
2019-01-28 17:19:57 +08:00
var temp = Path.GetTempFileName() + ".osz";
using (var stream = GetTestBeatmapStream())
using (var newFile = File.Create(temp))
stream.CopyTo(newFile);
2018-04-13 17:19:50 +08:00
2019-01-28 17:19:57 +08:00
Assert.IsTrue(File.Exists(temp));
return temp;
2018-04-13 17:19:50 +08:00
}
}
}