public void Extension()
        {
            CDBuilder builder = new CDBuilder();
            CDReader  fs      = new CDReader(builder.Build(), false);

            Assert.AreEqual("dir", fs.GetDirectoryInfo("fred.dir").Extension);
            Assert.AreEqual("", fs.GetDirectoryInfo("fred").Extension);
        }
        public void Extension()
        {
            CDBuilder builder = new CDBuilder();
            CDReader fs = new CDReader(builder.Build(), false);

            Assert.AreEqual("dir", fs.GetDirectoryInfo("fred.dir").Extension);
            Assert.AreEqual("", fs.GetDirectoryInfo("fred").Extension);
        }
        public void FullName()
        {
            CDBuilder builder = new CDBuilder();
            CDReader  fs      = new CDReader(builder.Build(), false);

            Assert.AreEqual(@"\", fs.Root.FullName);
            Assert.AreEqual(@"SOMEDIR\", fs.GetDirectoryInfo(@"SOMEDIR").FullName);
            Assert.AreEqual(@"SOMEDIR\CHILDDIR\", fs.GetDirectoryInfo(@"SOMEDIR\CHILDDIR").FullName);
        }
Example #4
0
        public void Parent()
        {
            CDBuilder builder = new CDBuilder();

            builder.AddFile(@"SOMEDIR\ADIR\FILE.TXT", new byte[] { 1 });
            CDReader fs = new CDReader(builder.Build(), false);

            DiscFileInfo fi = fs.GetFileInfo(@"SOMEDIR\ADIR\FILE.TXT");

            Assert.AreEqual(fs.GetDirectoryInfo(@"SOMEDIR\ADIR"), fi.Parent);
            Assert.AreEqual(fs.GetDirectoryInfo(@"SOMEDIR\ADIR"), fi.Directory);
        }
Example #5
0
 public void DirectoryInfo()
 {
     CDBuilder builder = new CDBuilder();
     CDReader fs = new CDReader(builder.Build(), false);
     DiscDirectoryInfo fi = fs.GetDirectoryInfo(@"SOMEDIR");
     Assert.IsNotNull(fi);
 }
        public void DirectoryInfo()
        {
            CDBuilder         builder = new CDBuilder();
            CDReader          fs      = new CDReader(builder.Build(), false);
            DiscDirectoryInfo fi      = fs.GetDirectoryInfo(@"SOMEDIR");

            Assert.IsNotNull(fi);
        }
        public void SimpleSearch()
        {
            CDBuilder builder = new CDBuilder();

            builder.AddFile(@"SOMEDIR\CHILDDIR\GCHILDIR\FILE.TXT", new byte[0]);
            CDReader fs = new CDReader(builder.Build(), false);

            DiscDirectoryInfo di = fs.GetDirectoryInfo(@"SOMEDIR\CHILDDIR");

            DiscFileInfo[] fis = di.GetFiles("*.*", SearchOption.AllDirectories);
        }
        public void Exists()
        {
            CDBuilder builder = new CDBuilder();
            builder.AddFile(@"SOMEDIR\CHILDDIR\FILE.TXT", new byte[0]);
            CDReader fs = new CDReader(builder.Build(), false);

            Assert.IsTrue(fs.GetDirectoryInfo(@"\").Exists);
            Assert.IsTrue(fs.GetDirectoryInfo(@"SOMEDIR").Exists);
            Assert.IsTrue(fs.GetDirectoryInfo(@"SOMEDIR\CHILDDIR").Exists);
            Assert.IsTrue(fs.GetDirectoryInfo(@"SOMEDIR\CHILDDIR\").Exists);
            Assert.IsFalse(fs.GetDirectoryInfo(@"NONDIR").Exists);
            Assert.IsFalse(fs.GetDirectoryInfo(@"SOMEDIR\NONDIR").Exists);
        }
        public void Exists()
        {
            CDBuilder builder = new CDBuilder();

            builder.AddFile(@"SOMEDIR\CHILDDIR\FILE.TXT", new byte[0]);
            CDReader fs = new CDReader(builder.Build(), false);

            Assert.IsTrue(fs.GetDirectoryInfo(@"\").Exists);
            Assert.IsTrue(fs.GetDirectoryInfo(@"SOMEDIR").Exists);
            Assert.IsTrue(fs.GetDirectoryInfo(@"SOMEDIR\CHILDDIR").Exists);
            Assert.IsTrue(fs.GetDirectoryInfo(@"SOMEDIR\CHILDDIR\").Exists);
            Assert.IsFalse(fs.GetDirectoryInfo(@"NONDIR").Exists);
            Assert.IsFalse(fs.GetDirectoryInfo(@"SOMEDIR\NONDIR").Exists);
        }
Example #10
0
        public void Attributes()
        {
            // Start time rounded down to whole seconds
            DateTime start = DateTime.UtcNow;
            start = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, start.Second);

            CDBuilder builder = new CDBuilder();
            builder.AddDirectory("Foo");
            CDReader fs = new CDReader(builder.Build(), false);
            DateTime end = DateTime.UtcNow;

            DiscDirectoryInfo di = fs.GetDirectoryInfo("Foo");

            Assert.AreEqual(FileAttributes.Directory | FileAttributes.ReadOnly, di.Attributes);
            Assert.GreaterOrEqual(di.CreationTimeUtc, start);
            Assert.LessOrEqual(di.CreationTimeUtc, end);
            Assert.GreaterOrEqual(di.LastAccessTimeUtc, start);
            Assert.LessOrEqual(di.LastAccessTimeUtc, end);
            Assert.GreaterOrEqual(di.LastWriteTimeUtc, start);
            Assert.LessOrEqual(di.LastWriteTimeUtc, end);
        }
        public void Attributes()
        {
            // Start time rounded down to whole seconds
            DateTime start = DateTime.UtcNow;

            start = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, start.Second);

            CDBuilder builder = new CDBuilder();

            builder.AddDirectory("Foo");
            CDReader fs  = new CDReader(builder.Build(), false);
            DateTime end = DateTime.UtcNow;

            DiscDirectoryInfo di = fs.GetDirectoryInfo("Foo");

            Assert.AreEqual(FileAttributes.Directory | FileAttributes.ReadOnly, di.Attributes);
            Assert.GreaterOrEqual(di.CreationTimeUtc, start);
            Assert.LessOrEqual(di.CreationTimeUtc, end);
            Assert.GreaterOrEqual(di.LastAccessTimeUtc, start);
            Assert.LessOrEqual(di.LastAccessTimeUtc, end);
            Assert.GreaterOrEqual(di.LastWriteTimeUtc, start);
            Assert.LessOrEqual(di.LastWriteTimeUtc, end);
        }
Example #12
0
        public void Parent()
        {
            CDBuilder builder = new CDBuilder();
            builder.AddFile(@"SOMEDIR\ADIR\FILE.TXT", new byte[] { 1 });
            CDReader fs = new CDReader(builder.Build(), false);

            DiscFileInfo fi = fs.GetFileInfo(@"SOMEDIR\ADIR\FILE.TXT");
            Assert.AreEqual(fs.GetDirectoryInfo(@"SOMEDIR\ADIR"), fi.Parent);
            Assert.AreEqual(fs.GetDirectoryInfo(@"SOMEDIR\ADIR"), fi.Directory);
        }
Example #13
0
        public void FullName()
        {
            CDBuilder builder = new CDBuilder();
            CDReader fs = new CDReader(builder.Build(), false);

            Assert.AreEqual(@"\", fs.Root.FullName);
            Assert.AreEqual(@"SOMEDIR\", fs.GetDirectoryInfo(@"SOMEDIR").FullName);
            Assert.AreEqual(@"SOMEDIR\CHILDDIR\", fs.GetDirectoryInfo(@"SOMEDIR\CHILDDIR").FullName);
        }
Example #14
0
        public void SimpleSearch()
        {
            CDBuilder builder = new CDBuilder();
            builder.AddFile(@"SOMEDIR\CHILDDIR\GCHILDIR\FILE.TXT", new byte[0]);
            CDReader fs = new CDReader(builder.Build(), false);

            DiscDirectoryInfo di = fs.GetDirectoryInfo(@"SOMEDIR\CHILDDIR");
            DiscFileInfo[] fis = di.GetFiles("*.*", SearchOption.AllDirectories);
        }