Exemplo n.º 1
0
        public void TestDirectoryExist()
        {
            var srcPath  = @"../../../src";
            var destPath = @"../../../dest";

            FileIOSample.CreateDirectory(srcPath);
            FileIOSample.CreateDirectory(destPath);

            Assert.AreEqual(Directory.Exists(srcPath), true);
            Assert.AreEqual(Directory.Exists(destPath), true);
        }
Exemplo n.º 2
0
        public void TestFileSize()
        {
            var srcPath  = @"../../../src";
            var destPath = @"../../../dest";

            FileIOSample.CreateDirectory(srcPath);
            FileIOSample.CreateDirectory(destPath);

            var fileName     = "SampleWriteFile.TXT";
            var srcFilePath  = Path.Combine(srcPath, fileName);
            var destFilePath = Path.Combine(destPath, fileName);

            File.Delete(srcFilePath);
            File.Delete(destFilePath);

            FileIOSample.WriteUsingStreamWriter(srcFilePath);
            FileIOSample.WriteUsingStreamWriter(destFilePath);
            var  fileInfo = new FileInfo(srcFilePath);
            long size     = fileInfo.Length;
        }
Exemplo n.º 3
0
        public void TestFileMove()
        {
            var srcPath  = @"../../../src";
            var destPath = @"../../../dest";

            FileIOSample.CreateDirectory(srcPath);
            FileIOSample.CreateDirectory(destPath);

            var fileName     = "SampleWriteFile.TXT";
            var srcFilePath  = Path.Combine(srcPath, fileName);
            var destFilePath = Path.Combine(destPath, fileName);

            File.Delete(srcFilePath);
            File.Delete(destFilePath);

            FileIOSample.WriteUsingStreamWriter(srcFilePath);
            Assert.AreEqual(File.Exists(srcFilePath), true);

            File.Move(srcFilePath, destFilePath);
        }
Exemplo n.º 4
0
        public void TestLastModifiedTime()
        {
            var srcPath  = @"../../../src";
            var destPath = @"../../../dest";

            FileIOSample.CreateDirectory(srcPath);
            FileIOSample.CreateDirectory(destPath);

            var fileName     = "SampleWriteFile.TXT";
            var srcFilePath  = Path.Combine(srcPath, fileName);
            var destFilePath = Path.Combine(destPath, fileName);

            File.Delete(srcFilePath);
            File.Delete(destFilePath);

            FileIOSample.WriteUsingStreamWriter(srcFilePath);
            FileIOSample.WriteUsingStreamWriter(destFilePath);

            var lastWriteTime = File.GetLastWriteTime(srcFilePath);

            File.SetLastWriteTime(destFilePath, lastWriteTime);

            Assert.AreEqual(File.GetLastWriteTime(srcFilePath), File.GetLastWriteTime(destFilePath));
        }