コード例 #1
0
 public void Equals_DifferentKeys_AreNotEqual()
 {
     var key1 = 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.IsFalse(key1.Equals(key2));
 }
コード例 #2
0
 public void Equals_IdenticalKeys_AreEqual()
 {
     var key1 = 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.IsTrue(key1.Equals(key2));
 }
コード例 #3
0
        public void Equals_AllPropertiesAreTakenIntoAccount()
        {
            var key1 = new JavascriptAssetKey();
            var key2 = new JavascriptAssetKey();
            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));
        }
コード例 #4
0
 public void Equals_NullKey_DoesNotEqualNonNullKey()
 {
     var key1 = new JavascriptAssetKey();
     Assert.IsFalse(key1.Equals(null));
 }
コード例 #5
0
 public void Equals_CssKey_DoesNotEqualJavascriptKey()
 {
     var key1 = new JavascriptAssetKey { IsExternal = true };
     var key2 = new CssAssetKey { IsExternal = true };
     Assert.IsFalse(key1.Equals(key2));
 }
コード例 #6
0
 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()));
 }
コード例 #7
0
 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());
 }
コード例 #8
0
 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());
 }
コード例 #9
0
 public void GetHashCode_CssAssetKey_HasDifferentHashCodeThanCssAsset()
 {
     var key = new JavascriptAssetKey { IsExternal = true };
     var cssKey = new CssAssetKey { IsExternal = true };
     Assert.That(key.GetHashCode(), Is.Not.EqualTo(cssKey.GetHashCode()));
 }
コード例 #10
0
 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));
 }