Пример #1
0
 public void InitializationTest()
 {
     FileManager Manager = new FileManager();
     Assert.NotEqual(null, Manager["Relative Local"]);
     Assert.NotEqual(null, Manager["Absolute Local"]);
     Assert.NotEqual(null, Manager["Network"]);
 }
Пример #2
0
 public void DirectoryRenameTest()
 {
     var Manager = new FileManager();
     IDirectory TempObject = Manager.Directory("~/Data/Test");
     TempObject.Create();
     string DirectoryPath = TempObject.Parent.FullName;
     TempObject.Rename("Test2");
     Assert.Equal(DirectoryPath + "\\Test2", TempObject.FullName);
     TempObject.Delete();
 }
Пример #3
0
 public void FileMoveToTest()
 {
     var Manager = new FileManager();
     IFile TempObject = Manager.File("~/Data/Test/Data.txt");
     TempObject.Write("This is a test");
     IDirectory NewParent = Manager.Directory("~/Data2/");
     NewParent.Create();
     TempObject.MoveTo(NewParent);
     Assert.Equal(NewParent.FullName + "Data.txt", TempObject.FullName);
     TempObject.Delete();
 }
Пример #4
0
 public void DirectoryMoveToTest()
 {
     var Manager = new FileManager();
     IDirectory TempObject = Manager.Directory("~/Data/Test");
     TempObject.Create();
     IDirectory NewParent = Manager.Directory("~/Data2/");
     NewParent.Create();
     TempObject.MoveTo(NewParent);
     Assert.Equal(NewParent.FullName + "Test", TempObject.FullName);
     TempObject.Delete();
 }
Пример #5
0
 public void DirectoryTest()
 {
     var Manager = new FileManager();
     IDirectory TempObject = Manager.Directory("~/Data/Test");
     Assert.Equal(false, TempObject.Exists);
     Assert.Equal("Test", TempObject.Name);
     Assert.Equal("Data", TempObject.Parent.Name);
     Assert.Equal(0, TempObject.Size);
     TempObject.Create();
     Assert.Equal(true, TempObject.Exists);
     Assert.Equal("Test", TempObject.Name);
     Assert.Equal("Data", TempObject.Parent.Name);
     TempObject.Delete();
     Assert.Equal(false, TempObject.Exists);
     Assert.Equal("Test", TempObject.Name);
     Assert.Equal("Data", TempObject.Parent.Name);
 }
Пример #6
0
 public void FileTest()
 {
     
     FileManager Manager = new FileManager();
     IFile TempObject = Manager.File("~/Data/Test/Data.txt");
     Assert.Equal(false, TempObject.Exists);
     Assert.Equal("Data.txt", TempObject.Name);
     Assert.Equal("Test", TempObject.Directory.Name);
     Assert.Equal(0, TempObject.Length);
     TempObject.Write("This is a test");
     Assert.Equal(true, TempObject.Exists);
     Assert.Equal("Data.txt", TempObject.Name);
     Assert.Equal("Test", TempObject.Directory.Name);
     Assert.Equal(14, TempObject.Length);
     TempObject.Delete();
     Assert.Equal(false, TempObject.Exists);
     Assert.Equal("Data.txt", TempObject.Name);
     Assert.Equal("Test", TempObject.Directory.Name);
     Assert.Equal(0, TempObject.Length);
 }
Пример #7
0
 private IFile DetermineFile(IFile File, FileManager FileSystem, IAsset Asset, string TempFile)
 {
     if (File == null || !File.Exists)
     {
         IFile AssetFile = FileSystem.File(Asset.Path);
         File = FileSystem.File(AssetFile.Directory.FullName + "\\" + TempFile);
     }
     if (File == null || !File.Exists)
     {
         foreach (IAsset SubAsset in Asset.Included)
         {
             IFile Temp = DetermineFile(File, FileSystem, SubAsset, TempFile);
             if (Temp.Exists)
                 return Temp;
         }
     }
     return File;
 }
Пример #8
0
 public void FileRenameTest()
 {
     var Manager = new FileManager();
     IFile TempObject = Manager.File("~/Data/Test/Data.txt");
     TempObject.Write("This is a test");
     string DirectoryPath = TempObject.Directory.FullName;
     TempObject.Rename("Test2.txt");
     Assert.Equal(DirectoryPath + "\\Test2.txt", TempObject.FullName);
     TempObject.Delete();
 }
Пример #9
0
 public void Dispose()
 {
     var Manager = new FileManager();
     Manager.Directory("~/Data/").Delete();
     Manager.Directory("~/Data2/").Delete();
 }