Beispiel #1
0
        public void CalculateBytesFromNull()
        {
            Md5Sum sum = new Md5Sum();

            Assert.IsNotNull(sum);

            byte[] check = sum.Calculate((byte[])null);
        }
Beispiel #2
0
        public void CalculateBytesFromEmpty()
        {
            Md5Sum sum = new Md5Sum();

            Assert.IsNotNull(sum);

            byte[] data  = new byte[0];
            byte[] check = sum.Calculate(data);
            Assert.IsNotNull(check);
            Assert.AreEqual(16, check.Length);
        }
Beispiel #3
0
        public void CalculateFromTestFile1()
        {
            Md5Sum sum = new Md5Sum();

            Assert.IsNotNull(sum);

            byte[] array = File.ReadAllBytes("../../TestData/TextFile1.txt");
            byte[] check = sum.Calculate(array);

            Assert.IsNotNull(check);
            Assert.AreEqual(16, check.Length);
            for (int i = 0; i < File1Sum.Length; i++)
            {
                if (check[i] != File1Sum[i])
                {
                    Assert.Fail("Result byte {0} does not match! Was {1}, expected {2}",
                                i, check[i], File1Sum[i]);
                }
            }
        }
Beispiel #4
0
        public void CalculateFromTestFile1Stream()
        {
            Md5Sum sum = new Md5Sum();

            Assert.IsNotNull(sum);

            FileStream file = new FileStream("../../TestData/TextFile1.txt",
                                             FileMode.Open);

            byte[] check = sum.Calculate(file);
            file.Close();

            Assert.IsNotNull(check);
            Assert.AreEqual(16, check.Length);
            for (int i = 0; i < File1Sum.Length; i++)
            {
                if (check[i] != File1Sum[i])
                {
                    Assert.Fail("Result byte {0} does not match! Was {1}, expected {2}",
                                i, check[i], File1Sum[i]);
                }
            }
        }
Beispiel #5
0
        public void CalculateFromTestFile1Stream()
        {
            Md5Sum sum = new Md5Sum();
            Assert.IsNotNull(sum);

            FileStream file = new FileStream("../../TestData/TextFile1.txt",
                FileMode.Open);
            byte[] check = sum.Calculate(file);
            file.Close();

            Assert.IsNotNull(check);
            Assert.AreEqual(16, check.Length);
            for (int i = 0; i < File1Sum.Length; i++)
            {
                if (check[i] != File1Sum[i])
                {
                    Assert.Fail("Result byte {0} does not match! Was {1}, expected {2}",
                        i, check[i], File1Sum[i]);
                }
            }
        }
Beispiel #6
0
        public void CalculateFromTestFile1()
        {
            Md5Sum sum = new Md5Sum();
            Assert.IsNotNull(sum);

            byte[] array = File.ReadAllBytes("../../TestData/TextFile1.txt");
            byte[] check = sum.Calculate(array);

            Assert.IsNotNull(check);
            Assert.AreEqual(16, check.Length);
            for (int i = 0; i < File1Sum.Length; i++)
            {
                if (check[i] != File1Sum[i])
                {
                    Assert.Fail("Result byte {0} does not match! Was {1}, expected {2}",
                        i, check[i], File1Sum[i]);
                }
            }
        }
Beispiel #7
0
        public void CalculateBytesFromNull()
        {
            Md5Sum sum = new Md5Sum();
            Assert.IsNotNull(sum);

            byte[] check = sum.Calculate((byte[])null);
        }
Beispiel #8
0
        public void CalculateBytesFromEmpty()
        {
            Md5Sum sum = new Md5Sum();
            Assert.IsNotNull(sum);

            byte[] data = new byte[0];
            byte[] check = sum.Calculate(data);
            Assert.IsNotNull(check);
            Assert.AreEqual(16, check.Length);
        }