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

            Assert.IsNotNull(sum);

            bool match = sum.Verify(new byte[1], (byte[])null);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #6
0
        public void VerifyNullArray2()
        {
            Md5Sum sum = new Md5Sum();
            Assert.IsNotNull(sum);

            bool match = sum.Verify(new byte[1], (byte[])null);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }