1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 15:22:55 +08:00

Move null check outside of the loop

This commit is contained in:
Shivam 2020-06-24 20:43:56 +02:00
parent c94f95cc0d
commit 063503f4db

View File

@ -152,16 +152,19 @@ namespace osu.Game.Tests.NonVisual
Assert.That(!host.Storage.ExistsDirectory(Path.Combine("test-nested", "cache"))); Assert.That(!host.Storage.ExistsDirectory(Path.Combine("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?.IgnoreFiles ?? Array.Empty<string>()) if (osuStorage != null)
{ {
Assert.That(host.Storage.Exists(file), Is.True); foreach (var file in osuStorage.IgnoreFiles)
Assert.That(storage.Exists(file), Is.False); {
} Assert.That(host.Storage.Exists(file), Is.True);
Assert.That(storage.Exists(file), Is.False);
}
foreach (var dir in osuStorage?.IgnoreDirectories ?? Array.Empty<string>()) foreach (var dir in osuStorage.IgnoreDirectories)
{ {
Assert.That(host.Storage.ExistsDirectory(dir), Is.True); Assert.That(host.Storage.ExistsDirectory(dir), Is.True);
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(host.Storage.GetStream("storage.ini")).ReadToEnd().Contains($"FullPath = {customPath}"));