Пример #1
0
        public void TestWithDifferentKey()
        {
            IHashWithKey LIHashWithKey;

            string ExpectedString = ExpectedHashOfDefaultDataWithMaxUInt32AsKey;

            LIHashWithKey     = (hash as IHashWithKey);
            LIHashWithKey.Key = Converters.ReadUInt32AsBytesLE(UInt32.MaxValue);

            string ActualString = LIHashWithKey.ComputeString(TestConstants.DefaultData,
                                                              Encoding.UTF8).ToString();

            Assert.AreEqual(ExpectedString, ActualString);
        }
        public void TestWithDifferentKeyOneEmptyString()
        {
            IHashWithKey LIHashWithKey;

            string ExpectedString = ExpectedHashOfEmptyDataWithOneAsKey;

            LIHashWithKey     = (hash.Clone() as IHashWithKey);
            LIHashWithKey.Key = Converters.ReadUInt32AsBytesLE((UInt32)1);

            string ActualString = LIHashWithKey.ComputeString(TestConstants.EmptyData,
                                                              Encoding.UTF8).ToString();

            Assert.AreEqual(ExpectedString, ActualString,
                            String.Format("Expected {0} but got {1}.",
                                          ExpectedString, ActualString));
        }
Пример #3
0
        public void TestZeroToFifteenInHex()
        {
            IHashWithKey LIHashWithKey;

            string ExpectedString = ExpectedHashWithExternalKey;

            LIHashWithKey     = (hash as IHashWithKey);
            LIHashWithKey.Key = Converters.ConvertHexStringToBytes(TestConstants.ZeroToFifteenInHex);

            string ActualString = LIHashWithKey.ComputeString(TestConstants.DefaultData,
                                                              Encoding.UTF8).ToString();

            Assert.AreEqual(ExpectedString, ActualString,
                            String.Format("Expected {0} but got {1}.",
                                          ExpectedString, ActualString));
        }