Esempio n. 1
0
        public void GetHashCode_JavascriptAssetKey_HasDifferentHashCodeThanCssAsset()
        {
            var key = new CssAssetKey {
                IsExternal = true
            };
            var jsKey = new JavascriptAssetKey {
                IsExternal = true
            };

            Assert.That(key.GetHashCode(), Is.Not.EqualTo(jsKey.GetHashCode()));
        }
        public void GetHashCode_SimilarKeys_HaveDifferentHashCodes()
        {
            var key1 = new JavascriptAssetKey {
                Browser = (IE.Version) 2
            };
            var key2 = new JavascriptAssetKey {
                Equality = (IE.Equality) 2
            };

            Assert.That(key1.GetHashCode(), Is.Not.EqualTo(key2.GetHashCode()));
        }
        public void GetHashCode_AllPropertiesAreTakenIntoAccount()
        {
            var key   = new JavascriptAssetKey();
            var hash1 = key.GetHashCode();

            key.Browser = IE.Version.IE6;
            var hash2 = key.GetHashCode();

            Assert.That(hash1, Is.Not.EqualTo(hash2));
            key.Equality = IE.Equality.LessThan;
            var hash3 = key.GetHashCode();

            Assert.That(hash1, Is.Not.EqualTo(hash3));
            Assert.That(hash2, Is.Not.EqualTo(hash3));
            key.IsExternal = true;
            var hash4 = key.GetHashCode();

            Assert.That(hash1, Is.Not.EqualTo(hash4));
            Assert.That(hash2, Is.Not.EqualTo(hash4));
            Assert.That(hash3, Is.Not.EqualTo(hash4));
        }
        public void GetHashCode_DifferentKeys_HaveDifferentHashCode()
        {
            var key = new JavascriptAssetKey {
                Browser    = IE.Version.IE6,
                Equality   = IE.Equality.LessThan,
                IsExternal = true
            };
            var key2 = new JavascriptAssetKey {
                Browser    = IE.Version.IE5,
                Equality   = IE.Equality.LessThan,
                IsExternal = true
            };

            Assert.AreNotEqual(key.GetHashCode(), key2.GetHashCode());
        }
        public void GetHashCode_IdenticalKeys_HaveSameHashCode()
        {
            var key = new JavascriptAssetKey {
                Browser    = IE.Version.IE5,
                Equality   = IE.Equality.LessThan,
                IsExternal = true
            };
            var key2 = new JavascriptAssetKey {
                Browser    = IE.Version.IE5,
                Equality   = IE.Equality.LessThan,
                IsExternal = true
            };

            Assert.AreEqual(key.GetHashCode(), key2.GetHashCode());
        }