mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Fix test failing
This commit is contained in:
parent
ec55c80990
commit
1edfac4923
@ -127,6 +127,9 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
var osu = loadOsu(host);
|
var osu = loadOsu(host);
|
||||||
var storage = osu.Dependencies.Get<Storage>();
|
var storage = osu.Dependencies.Get<Storage>();
|
||||||
|
|
||||||
|
// Store the current storage's path. We'll need to refer to this for assertions in the original directory after the migration completes.
|
||||||
|
string originalDirectory = storage.GetFullPath(".");
|
||||||
|
|
||||||
// ensure we perform a save
|
// ensure we perform a save
|
||||||
host.Dependencies.Get<FrameworkConfigManager>().Save();
|
host.Dependencies.Get<FrameworkConfigManager>().Save();
|
||||||
|
|
||||||
@ -145,25 +148,25 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
Assert.That(storage.GetFullPath("."), Is.EqualTo(customPath));
|
Assert.That(storage.GetFullPath("."), Is.EqualTo(customPath));
|
||||||
|
|
||||||
// ensure cache was not moved
|
// ensure cache was not moved
|
||||||
Assert.That(host.Storage.ExistsDirectory("cache"));
|
Assert.That(Directory.Exists(Path.Combine(originalDirectory, "cache")));
|
||||||
|
|
||||||
// ensure nested cache was moved
|
// ensure nested cache was moved
|
||||||
Assert.That(!host.Storage.ExistsDirectory(Path.Combine("test-nested", "cache")));
|
Assert.That(!Directory.Exists(Path.Combine(originalDirectory, "test-nested", "cache")));
|
||||||
Assert.That(storage.ExistsDirectory(Path.Combine("test-nested", "cache")));
|
Assert.That(storage.ExistsDirectory(Path.Combine("test-nested", "cache")));
|
||||||
|
|
||||||
foreach (var file in OsuStorage.IGNORE_FILES)
|
foreach (var file in OsuStorage.IGNORE_FILES)
|
||||||
{
|
{
|
||||||
Assert.That(host.Storage.Exists(file), Is.True);
|
Assert.That(File.Exists(Path.Combine(originalDirectory, file)));
|
||||||
Assert.That(storage.Exists(file), Is.False);
|
Assert.That(storage.Exists(file), Is.False);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var dir in OsuStorage.IGNORE_DIRECTORIES)
|
foreach (var dir in OsuStorage.IGNORE_DIRECTORIES)
|
||||||
{
|
{
|
||||||
Assert.That(host.Storage.ExistsDirectory(dir), Is.True);
|
Assert.That(Directory.Exists(Path.Combine(originalDirectory, dir)));
|
||||||
Assert.That(storage.ExistsDirectory(dir), Is.False);
|
Assert.That(storage.ExistsDirectory(dir), Is.False);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.That(new StreamReader(host.Storage.GetStream("storage.ini")).ReadToEnd().Contains($"FullPath = {customPath}"));
|
Assert.That(new StreamReader(Path.Combine(originalDirectory, "storage.ini")).ReadToEnd().Contains($"FullPath = {customPath}"));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user