mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Add more edge case testing
This commit is contained in:
@ -123,6 +123,56 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMigrationBetweenTwoTargets()
|
||||||
|
{
|
||||||
|
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestMigrationBetweenTwoTargets)))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var osu = loadOsu(host);
|
||||||
|
var storage = osu.Dependencies.Get<Storage>();
|
||||||
|
|
||||||
|
string customPath2 = $"{customPath}-2";
|
||||||
|
|
||||||
|
const string database_filename = "client.db";
|
||||||
|
|
||||||
|
Assert.DoesNotThrow(() => (storage as OsuStorage)?.Migrate(customPath));
|
||||||
|
Assert.That(File.Exists(Path.Combine(customPath, database_filename)));
|
||||||
|
|
||||||
|
Assert.DoesNotThrow(() => (storage as OsuStorage)?.Migrate(customPath2));
|
||||||
|
Assert.That(File.Exists(Path.Combine(customPath2, database_filename)));
|
||||||
|
|
||||||
|
Assert.DoesNotThrow(() => (storage as OsuStorage)?.Migrate(customPath));
|
||||||
|
Assert.That(File.Exists(Path.Combine(customPath, database_filename)));
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
host.Exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMigrationToSameTargetFails()
|
||||||
|
{
|
||||||
|
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestMigrationToSameTargetFails)))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var osu = loadOsu(host);
|
||||||
|
var storage = osu.Dependencies.Get<Storage>();
|
||||||
|
|
||||||
|
Assert.DoesNotThrow(() => (storage as OsuStorage)?.Migrate(customPath));
|
||||||
|
Assert.Throws<InvalidOperationException>(() => (storage as OsuStorage)?.Migrate(customPath));
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
host.Exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private OsuGameBase loadOsu(GameHost host)
|
private OsuGameBase loadOsu(GameHost host)
|
||||||
{
|
{
|
||||||
var osu = new OsuGameBase();
|
var osu = new OsuGameBase();
|
||||||
|
Reference in New Issue
Block a user