7.6 merge review fixes
This commit is contained in:
@@ -6,12 +6,18 @@ using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
namespace Umbraco.Tests.IO
|
||||
{
|
||||
[TestFixture]
|
||||
public class ShadowFileSystemTests
|
||||
{
|
||||
// tested:
|
||||
// only 1 instance of this class is created
|
||||
// SetUp and TearDown run before/after each test
|
||||
// SetUp does not start before the previous TearDown returns
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
@@ -28,20 +34,8 @@ namespace Umbraco.Tests.IO
|
||||
|
||||
private static void ClearFiles()
|
||||
{
|
||||
var path = IOHelper.MapPath("FileSysTests");
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
foreach (var file in Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories))
|
||||
File.Delete(file);
|
||||
Directory.Delete(path, true);
|
||||
}
|
||||
path = IOHelper.MapPath("App_Data");
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
foreach (var file in Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories))
|
||||
File.Delete(file);
|
||||
Directory.Delete(path, true);
|
||||
}
|
||||
TestHelper.DeleteDirectory(IOHelper.MapPath("FileSysTests"));
|
||||
TestHelper.DeleteDirectory(IOHelper.MapPath("App_Data"));
|
||||
}
|
||||
|
||||
private static string NormPath(string path)
|
||||
@@ -341,8 +335,7 @@ namespace Umbraco.Tests.IO
|
||||
|
||||
Assert.IsTrue(File.Exists(path + "/ShadowSystem/path/to/some/dir/f1.txt"));
|
||||
|
||||
// kill everything and let the shadow fs die
|
||||
Directory.Delete(path + "/ShadowSystem", true);
|
||||
// let the shadow fs die
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -420,7 +413,7 @@ namespace Umbraco.Tests.IO
|
||||
Assert.AreEqual(1, Directory.GetDirectories(appdata + "/Shadow").Length);
|
||||
scope.Complete();
|
||||
Assert.IsTrue(fs.FileExists("sub/f4.txt"));
|
||||
Assert.AreEqual(0, Directory.GetDirectories(appdata + "/Shadow").Length);
|
||||
TestHelper.TryAssert(() => Assert.AreEqual(0, Directory.GetDirectories(appdata + "/Shadow").Length));
|
||||
scope.Dispose();
|
||||
Assert.IsTrue(fs.FileExists("sub/f4.txt"));
|
||||
Assert.IsFalse(Directory.Exists(appdata + "/Shadow/" + id));
|
||||
@@ -477,7 +470,7 @@ namespace Umbraco.Tests.IO
|
||||
Assert.IsTrue(fs.FileExists("sub/f2.txt"));
|
||||
scope.Dispose();
|
||||
Assert.IsTrue(fs.FileExists("sub/f2.txt"));
|
||||
Assert.IsFalse(Directory.Exists(appdata + "/Shadow/" + id));
|
||||
TestHelper.TryAssert(() => Assert.IsFalse(Directory.Exists(appdata + "/Shadow/" + id)));
|
||||
|
||||
string text;
|
||||
using (var s = fs.OpenFile("sub/f2.txt"))
|
||||
@@ -580,9 +573,8 @@ namespace Umbraco.Tests.IO
|
||||
File.WriteAllText(path + "/test/inner/f3.txt", "foo");
|
||||
|
||||
path = NormPath(path);
|
||||
Directory.Delete(path, true);
|
||||
|
||||
Assert.IsFalse(File.Exists(path + "/test/inner/f3.txt"));
|
||||
TestHelper.Try(() => Directory.Delete(path, true));
|
||||
TestHelper.TryAssert(() => Assert.IsFalse(File.Exists(path + "/test/inner/f3.txt")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user