Пример #1
0
        public void IsFileSameTest()
        {
            var tempFolder = GetTempFolder();
            var fs         = new FileSystemStorage();

            var path1 = fs.Combine(tempFolder, Guid.NewGuid().ToString());
            var path2 = fs.Combine(tempFolder, Guid.NewGuid().ToString());

            System.IO.File.WriteAllText(path1, "test");
            System.IO.File.WriteAllText(path2, "test");

            var result = fs.IsFileSame(path1, path2);

            if (result)
            {
                Trace.WriteLine($"Date signature: Files are the same: {path1}, {path2}");
                Assert.Fail();
            }

            var path3 = fs.Combine(tempFolder, Guid.NewGuid().ToString());

            fs.CopyFile(path1, path3);
            result = fs.IsFileSame(path1, path3);
            if (!result)
            {
                Trace.WriteLine($"Date signature: Files are not the same: {path1}, {path3}");
                Assert.Fail();
            }

            fs.DeleteFile(path1);
            fs.DeleteFile(path2);
            fs.DeleteFile(path3);
        }