Exemple #1
0
        public void VerifyNullArray2()
        {
            Md5Sum sum = new Md5Sum();

            Assert.IsNotNull(sum);

            bool match = sum.Verify(new byte[1], (byte[])null);
        }
Exemple #2
0
        public void VerifyFromTestFile1()
        {
            Md5Sum sum = new Md5Sum();

            Assert.IsNotNull(sum);

            byte[] array = File.ReadAllBytes("../../TestData/TextFile1.txt");
            bool   match = sum.Verify(array, File1Sum);

            Assert.IsTrue(match);
        }
Exemple #3
0
        public void VerifyFromTestFile1Stream()
        {
            Md5Sum sum = new Md5Sum();

            Assert.IsNotNull(sum);

            FileStream file = new FileStream("../../TestData/TextFile1.txt",
                                             FileMode.Open);
            bool match = sum.Verify(file, File1Sum);

            file.Close();
            Assert.IsTrue(match);
        }
Exemple #4
0
        public void VerifyFromTestFile1Fail()
        {
            Md5Sum sum = new Md5Sum();

            Assert.IsNotNull(sum);

            // Create invalid checksum
            byte[] invalidSum = new byte[16];
            Array.Copy(File1Sum, invalidSum, 16);
            invalidSum[3] = 0x00;

            byte[] array = File.ReadAllBytes("../../TestData/TextFile1.txt");
            bool   match = sum.Verify(array, invalidSum);

            Assert.IsFalse(match);
        }
Exemple #5
0
        public void VerifyFromTestFile1StreamFail()
        {
            Md5Sum sum = new Md5Sum();

            Assert.IsNotNull(sum);

            // Create invalid checksum
            byte[] invalidSum = new byte[16];
            Array.Copy(File1Sum, invalidSum, 16);
            invalidSum[3] = 0x00;

            FileStream file = new FileStream("../../TestData/TextFile1.txt",
                                             FileMode.Open);
            bool match = sum.Verify(file, invalidSum);

            file.Close();
            Assert.IsFalse(match);
        }
Exemple #6
0
        public void VerifyNullArray2()
        {
            Md5Sum sum = new Md5Sum();
            Assert.IsNotNull(sum);

            bool match = sum.Verify(new byte[1], (byte[])null);
        }
Exemple #7
0
        public void VerifyFromTestFile1StreamFail()
        {
            Md5Sum sum = new Md5Sum();
            Assert.IsNotNull(sum);

            // Create invalid checksum
            byte[] invalidSum = new byte[16];
            Array.Copy(File1Sum, invalidSum, 16);
            invalidSum[3] = 0x00;

            FileStream file = new FileStream("../../TestData/TextFile1.txt",
                FileMode.Open);
            bool match = sum.Verify(file, invalidSum);
            file.Close();
            Assert.IsFalse(match);
        }
Exemple #8
0
        public void VerifyFromTestFile1Stream()
        {
            Md5Sum sum = new Md5Sum();
            Assert.IsNotNull(sum);

            FileStream file = new FileStream("../../TestData/TextFile1.txt",
                FileMode.Open);
            bool match = sum.Verify(file, File1Sum);
            file.Close();
            Assert.IsTrue(match);
        }
Exemple #9
0
        public void VerifyFromTestFile1Fail()
        {
            Md5Sum sum = new Md5Sum();
            Assert.IsNotNull(sum);

            // Create invalid checksum
            byte[] invalidSum = new byte[16];
            Array.Copy(File1Sum, invalidSum, 16);
            invalidSum[3] = 0x00;

            byte[] array = File.ReadAllBytes("../../TestData/TextFile1.txt");
            bool match = sum.Verify(array, invalidSum);
            Assert.IsFalse(match);
        }
Exemple #10
0
        public void VerifyFromTestFile1()
        {
            Md5Sum sum = new Md5Sum();
            Assert.IsNotNull(sum);

            byte[] array = File.ReadAllBytes("../../TestData/TextFile1.txt");
            bool match = sum.Verify(array, File1Sum);
            Assert.IsTrue(match);
        }