Initial commit

This commit is contained in:
grzegorz.russek
2024-05-15 09:38:41 +02:00
commit 5f748e55a2
23 changed files with 3488 additions and 0 deletions

View 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\\"));
}
}
}