Beispiel #1
0
        public void WindowsFileProperties()
        {
            if (!Global.TestWindows)
            {
                throw new Exception("Windows Tests Are Not Enabled.  Set Global.TestWindows To True To Enable.");
            }

            String fileName = Global.RandomFile;
            String path     = Path.Combine(Global.WindowsWorkingPath, $"{fileName}");

            Console.WriteLine(path);
            ZephyrFile file = new WindowsZephyrFile(path);

            file.Create();
            file.Close();
            file.Open(AccessType.Write);

            Console.WriteLine($"FullName : {file.FullName}");
            Assert.AreEqual(file.FullName, path);

            Console.WriteLine($"Name     : {file.Name}");
            Assert.AreEqual(file.Name, fileName);

            Console.WriteLine($"Exists   : {file.Exists}");
            Assert.That(file.Exists);

            Console.WriteLine($"Stream   : {(file.Stream.CanWrite ? "Writable" : "Not Writable")}");
            Assert.That(file.Stream.CanWrite);

            Console.WriteLine($"IsOpen   : {file.IsOpen}");
            Assert.That(file.IsOpen);

            Console.WriteLine($"CanRead  : {file.CanRead}");
            Assert.That(!file.CanRead);

            Console.WriteLine($"CanWrite : {file.CanWrite}");
            Assert.That(file.CanWrite);

            file.Close();
            file.Delete();
        }
Beispiel #2
0
        public void WindowsFileDelete()
        {
            if (!Global.TestWindows)
            {
                throw new Exception("Windows Tests Are Not Enabled.  Set Global.TestWindows To True To Enable.");
            }

            String path = Path.Combine(Global.WindowsWorkingPath, $"{Global.RandomFile}");

            Console.WriteLine(path);
            ZephyrFile file = new WindowsZephyrFile(path);

            file.Create();
            file.Close();
            file.Delete();
            Assert.That(!Utilities.Exists(path, Global.Clients));
        }
Beispiel #3
0
        public void WindowsFileClose()
        {
            if (!Global.TestWindows)
            {
                throw new Exception("Windows Tests Are Not Enabled.  Set Global.TestWindows To True To Enable.");
            }

            String path = Path.Combine(Global.WindowsWorkingPath, Global.RandomFile);

            Console.WriteLine(path);
            ZephyrFile file = new WindowsZephyrFile(path);

            file.Open(AccessType.Write);
            Assert.That(file.Stream.CanWrite);
            file.Close();
            Assert.IsNull(file.Stream);
            file.Delete();
        }
Beispiel #4
0
        public void WindowsFileReopen()
        {
            if (!Global.TestWindows)
            {
                throw new Exception("Windows Tests Are Not Enabled.  Set Global.TestWindows To True To Enable.");
            }

            String path = Path.Combine(Global.WindowsWorkingPath, $"{Global.RandomFile}");

            Console.WriteLine(path);
            ZephyrFile file = new WindowsZephyrFile(path);

            System.IO.Stream stream = file.Open(AccessType.Read);
            Assert.That(stream.CanRead);
            Assert.That(!stream.CanWrite);

            stream = file.Reopen(AccessType.Write);
            Assert.That(!stream.CanRead);
            Assert.That(stream.CanWrite);

            file.Close();
            file.Delete();
        }