Esempio n. 1
0
        public void Exists_NoBinaryCheck_Test()
        {
            var option = WriteCheckOption.None;

            // Destination not exists should write.
            var random  = new Random();
            var content = Enumerable.Range(0, 10).Select(x => (byte)random.Next(0, 254)).ToArray();
            var a       = Path.Combine(_path, "a");

            Assert.False(FileChecker.Exists(content, a, option));
            Write(content, a);
            Assert.True(FileChecker.Exists(content, a, option));

            // Binary match file should re-write.
            Write(content, a);
            Assert.True(FileChecker.Exists(content, a, option));

            // Binary mismatch file should re-write.
            var mismatchContent = content.Append((byte)random.Next(0, 254)).ToArray();

            Assert.True(FileChecker.Exists(mismatchContent, a, option));
            Write(mismatchContent, a);
            Assert.True(FileChecker.Exists(mismatchContent, a, option));
        }