Пример #1
0
        public void ConfigurationProvider_CompareHashes()
        {
            byte[] b1 = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            byte[] b2 = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            byte[] b3 = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            byte[] b4 = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 11 };

            KeyedCollection <string, ConfigurationSection>        kc = new TestKeyedCollection();
            ConfigurationProvider <TestQueueServiceConfiguration> cp = new ConfigurationProvider <TestQueueServiceConfiguration>(serviceName, configPath, kc);

            Assert.IsFalse(cp.CompareHashes(null, null));
            Assert.IsFalse(cp.CompareHashes(b1, null));
            Assert.IsFalse(cp.CompareHashes(null, b2));
            Assert.IsFalse(cp.CompareHashes(b1, b3));
            Assert.IsFalse(cp.CompareHashes(b3, b2));
            Assert.IsFalse(cp.CompareHashes(b1, b4));
            Assert.IsFalse(cp.CompareHashes(b4, b1));
            Assert.IsTrue(cp.CompareHashes(b1, b2));
            Assert.IsTrue(cp.CompareHashes(b2, b1));
        }