44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
using VirtualFS.Implementation;
|
|
using VirtualFS.Physical;
|
|
|
|
namespace VirtualFS.Tests
|
|
{
|
|
[TestClass]
|
|
public class RootFileSystemTest
|
|
{
|
|
private RootFileSystem _root;
|
|
private string _realRootPath = "C:\\Temp\\";
|
|
|
|
[TestInitialize]
|
|
public virtual void SetUp()
|
|
{
|
|
if (!System.IO.Directory.Exists(_realRootPath))
|
|
System.IO.Directory.CreateDirectory(_realRootPath);
|
|
|
|
_root = new RootFileSystem();
|
|
_root.Mount(new PhysicalFileSystem(new System.IO.DirectoryInfo(_realRootPath)), (Path)"/");
|
|
}
|
|
|
|
[TestMethod]
|
|
public virtual void TestEnumerate()
|
|
{
|
|
var root = new RootFileSystem();
|
|
root.Mount(new PhysicalFileSystem(new System.IO.DirectoryInfo("C:\\")), (Path)"/");
|
|
root.Mount(new PhysicalFileSystem(new System.IO.DirectoryInfo("C:\\")), (Path)"/");
|
|
|
|
Assert.AreEqual(new PhysicalFileSystem(new System.IO.DirectoryInfo("C:\\")).GetEntries("/").Count(), root.GetEntries("/").Count());
|
|
}
|
|
|
|
[TestMethod]
|
|
public virtual void TestDirectoryCreateAndDelete()
|
|
{
|
|
var dir = _root.Root.Create("Test");
|
|
|
|
Assert.IsTrue(System.IO.Directory.Exists(_realRootPath + "Test\\"));
|
|
|
|
dir.Delete();
|
|
|
|
Assert.IsFalse(System.IO.Directory.Exists(_realRootPath + "Test\\"));
|
|
}
|
|
}
|
|
} |