Ejemplo n.º 1
0
 public void CreateSubDirectoryTest()
 {
     using (var testEnvironment = StreamTestEnvironment.FromExistingVhdx(true))
     {
         using (var filesystem = new ExFatEntryFilesystem(testEnvironment.PartitionStream))
         {
             var s1 = filesystem.CreateDirectory(filesystem.RootDirectory, "SubOne");
             var n2 = "SubTwo";
             var s2 = filesystem.CreateDirectory(s1, n2);
             var f2 = filesystem.FindChild(s1, n2);
             Assert.IsNotNull(f2);
         }
     }
 }
Ejemplo n.º 2
0
 public void CreateDirectoryTest()
 {
     using (var testEnvironment = StreamTestEnvironment.FromExistingVhdx(true))
     {
         using (var filesystem = new ExFatEntryFilesystem(testEnvironment.PartitionStream))
         {
             var directoryName = "Orphaaaan 1";
             var s1            = filesystem.CreateDirectory(filesystem.RootDirectory, directoryName);
             var f1            = filesystem.FindChild(filesystem.RootDirectory, directoryName);
             // do more checks?
             Assert.IsNotNull(f1);
         }
     }
 }
Ejemplo n.º 3
0
 public void RandomReadWriteTest()
 {
     using (var testEnvironment = StreamTestEnvironment.FromExistingVhdx(true))
     {
         using (var filesystem = new ExFatEntryFilesystem(testEnvironment.PartitionStream))
         {
             var testFolder   = filesystem.CreateDirectory(filesystem.RootDirectory, "inner looping test");
             var random       = new Random(0);
             var fileIndex    = 0;
             var catalogCache = new List <string>();
             for (int loop = 0; loop < 10; loop++)
             {
                 // delete some
                 var existingFiles = filesystem.EnumerateFileSystemEntries(testFolder).ToArray();
                 for (int index = 0; index < existingFiles.Length; index++)
                 {
                     if (random.Next(0, 2) == 0)
                     {
                         filesystem.Delete(existingFiles[index]);
                         Assert.IsTrue(catalogCache.Remove(existingFiles[index].Name));
                     }
                 }
                 // add some
                 var newFilesCount = random.Next(100, 300);
                 for (int index = 0; index < newFilesCount; index++)
                 {
                     ++fileIndex;
                     var fileName = fileIndex.ToString();
                     using (var s = filesystem.CreateFile(testFolder, fileName))
                     {
                         var l = random.Next(0, 1000);
                         var b = BitConverter.GetBytes(fileIndex);
                         for (int i = 0; i < l; i++)
                         {
                             s.Write(b, 0, b.Length);
                         }
                     }
                     catalogCache.Add(fileName);
                 }
             }
         }
     }
 }