Initial commit
This commit is contained in:
44
VirtualFS.Tests/RootFileSystemTest.cs
Normal file
44
VirtualFS.Tests/RootFileSystemTest.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
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\\"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user