示例#1
0
        public void CalculateFromBytesNull()
        {
            Sha1Sum sum = new Sha1Sum();

            Assert.IsNotNull(sum);

            byte[] check = sum.Calculate((byte[])null);
            Assert.IsNull(check);
        }
示例#2
0
        public void CalculateFromEmptyTable()
        {
            Sha1Sum sum = new Sha1Sum();

            Assert.IsNotNull(sum);

            byte[] array = new byte[0];
            byte[] check = sum.Calculate(array);
            Assert.IsNotNull(check);
            Assert.AreEqual(Sha1Sum.SumSize, check.Length);
        }
示例#3
0
        public void CalculateFromTestFile1()
        {
            Sha1Sum sum = new Sha1Sum();

            Assert.IsNotNull(sum);

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

            Assert.IsNotNull(check);
            Assert.AreEqual(Sha1Sum.SumSize, 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:x2}, expected {2:x2}",
                                i, check[i], File1Sum[i]);
                }
            }
        }
示例#4
0
        public void CalculateFromTestFile1Stream()
        {
            Sha1Sum sum = new Sha1Sum();

            Assert.IsNotNull(sum);

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

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

            Assert.IsNotNull(check);
            Assert.AreEqual(Sha1Sum.SumSize, 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:x2}, expected {2:x2}",
                                i, check[i], File1Sum[i]);
                }
            }
        }
示例#5
0
        public void CalculateFromTestFile1Stream()
        {
            Sha1Sum sum = new Sha1Sum();
            Assert.IsNotNull(sum);

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

            Assert.IsNotNull(check);
            Assert.AreEqual(Sha1Sum.SumSize, 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:x2}, expected {2:x2}",
                        i, check[i], File1Sum[i]);
                }
            }
        }
示例#6
0
        public void CalculateFromTestFile1()
        {
            Sha1Sum sum = new Sha1Sum();
            Assert.IsNotNull(sum);

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

            Assert.IsNotNull(check);
            Assert.AreEqual(Sha1Sum.SumSize, 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:x2}, expected {2:x2}",
                        i, check[i], File1Sum[i]);
                }
            }
        }
示例#7
0
        public void CalculateFromEmptyTable()
        {
            Sha1Sum sum = new Sha1Sum();
            Assert.IsNotNull(sum);

            byte[] array = new byte[0];
            byte[] check = sum.Calculate(array);
            Assert.IsNotNull(check);
            Assert.AreEqual(Sha1Sum.SumSize, check.Length);
        }
示例#8
0
        public void CalculateFromBytesNull()
        {
            Sha1Sum sum = new Sha1Sum();
            Assert.IsNotNull(sum);

            byte[] check = sum.Calculate((byte[])null);
            Assert.IsNull(check);
        }