示例#1
0
        public void Equals_AllPropertiesAreTakenIntoAccount()
        {
            var key1 = new CssAssetKey {
                Media = "media"
            };
            var key2 = new CssAssetKey();

            Assert.IsFalse(key1.Equals(key2));
            key2.Media = "media";
            Assert.IsTrue(key1.Equals(key2));

            key1.Browser = IE.Version.IE6;
            Assert.IsFalse(key1.Equals(key2));
            key2.Browser = IE.Version.IE6;
            Assert.IsTrue(key1.Equals(key2));

            key1.Equality = IE.Equality.GreaterThan;
            Assert.IsFalse(key1.Equals(key2));
            key2.Equality = IE.Equality.GreaterThan;
            Assert.IsTrue(key1.Equals(key2));

            key1.IsExternal = true;
            Assert.IsFalse(key1.Equals(key2));
            key2.IsExternal = true;
            Assert.IsTrue(key1.Equals(key2));
        }
示例#2
0
        public void Equals_NullKey_DoesNotEqualNonNullKey()
        {
            var key1 = new CssAssetKey {
                Media = "media"
            };

            Assert.IsFalse(key1.Equals(null));
        }
示例#3
0
        public void Equals_JavascriptKey_DoesNotEqualCssKey()
        {
            var key1 = new CssAssetKey {
                IsExternal = true
            };
            var key2 = new JavascriptAssetKey {
                IsExternal = true
            };

            Assert.IsFalse(key1.Equals(key2));
        }
示例#4
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()));
        }
示例#5
0
        public void Equals_DifferentKeys_AreNotEqual()
        {
            var key1 = new CssAssetKey {
                Media      = "media1",
                Browser    = IE.Version.IE6,
                Equality   = IE.Equality.LessThan,
                IsExternal = true
            };
            var key2 = new CssAssetKey {
                Media      = "media1",
                Browser    = IE.Version.IE5,
                Equality   = IE.Equality.LessThan,
                IsExternal = true
            };

            Assert.IsFalse(key1.Equals(key2));
        }
示例#6
0
        public void Equals_IdenticalKeys_AreEqual()
        {
            var key1 = new CssAssetKey {
                Media      = "media1",
                Browser    = IE.Version.IE5,
                Equality   = IE.Equality.LessThan,
                IsExternal = true
            };
            var key2 = new CssAssetKey {
                Media      = "media1",
                Browser    = IE.Version.IE5,
                Equality   = IE.Equality.LessThan,
                IsExternal = true
            };

            Assert.IsTrue(key1.Equals(key2));
        }
示例#7
0
        public void GetHashCode_DifferentKeys_HaveDifferentHashCode()
        {
            var key = new CssAssetKey {
                Media      = "media1",
                Browser    = IE.Version.IE6,
                Equality   = IE.Equality.LessThan,
                IsExternal = true
            };
            var key2 = new CssAssetKey {
                Media      = "media1",
                Browser    = IE.Version.IE5,
                Equality   = IE.Equality.LessThan,
                IsExternal = true
            };

            Assert.AreNotEqual(key.GetHashCode(), key2.GetHashCode());
        }
示例#8
0
        public void GetHashCode_AllPropertiesAreTakenIntoAccount()
        {
            var key = new CssAssetKey {
                Media = "media1"
            };
            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));
        }