public void Equals_when_parts_equal_should_return_true()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", "dbo");

            Assert.Equal(defaultModelCacheKey1, defaultModelCacheKey2);
        }
        public void Equals_when_schema_not_equal_should_return_false()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "bar");

            Assert.NotEqual(defaultModelCacheKey1, defaultModelCacheKey2);
        }
        public void GetHashCode_when_schema_not_equal_should_return_false()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", "bar");

            Assert.NotEqual(defaultModelCacheKey1.GetHashCode(), defaultModelCacheKey2.GetHashCode());
        }
        public void Equals_when_provider_type_not_equal_should_return_false()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", new Mock <DbProviderFactory>().Object.GetType(), "dbo");

            Assert.NotEqual(defaultModelCacheKey1, defaultModelCacheKey2);
        }
        public void GetHashCode_when_provider_type_not_equal_should_return_different_values()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", new Mock <DbProviderFactory>().Object.GetType(), "dbo");

            Assert.NotEqual(defaultModelCacheKey1.GetHashCode(), defaultModelCacheKey2.GetHashCode());
        }
        public void Equals_when_parts_equal_should_return_true()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "dbo");

            Assert.Equal(defaultModelCacheKey1, defaultModelCacheKey2);
        }
        public void GetHashCode_when_parts_equal_should_return_same_value()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "dbo");

            Assert.Equal(defaultModelCacheKey1.GetHashCode(), defaultModelCacheKey2.GetHashCode());
        }
        public void Equals_when_providers_not_equal_should_return_false()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Bar", "dbo");

            Assert.NotEqual(defaultModelCacheKey1, defaultModelCacheKey2);
        }
        public void GetHashCode_when_schema_not_equal_should_return_false()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", "bar");

            Assert.NotEqual(defaultModelCacheKey1.GetHashCode(), defaultModelCacheKey2.GetHashCode());
        }
        public void GetHashCode_when_schema_not_equal_should_return_different_values()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "bar");

            Assert.NotEqual(defaultModelCacheKey1.GetHashCode(), defaultModelCacheKey2.GetHashCode());
        }
        public void GetHashCode_when_parts_equal_should_return_same_value()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", "dbo");

            Assert.Equal(defaultModelCacheKey1.GetHashCode(), defaultModelCacheKey2.GetHashCode());
        }
        public void Equals_when_providers_not_equal_should_return_false()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Bar", "dbo");

            Assert.NotEqual(defaultModelCacheKey1, defaultModelCacheKey2);
        }
        public void GetHashCode_when_provider_type_not_equal_should_return_different_values()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", new Mock<DbProviderFactory>().Object.GetType(), "dbo");

            Assert.NotEqual(defaultModelCacheKey1.GetHashCode(), defaultModelCacheKey2.GetHashCode());
        }
        public void Equals_when_provider_type_not_equal_should_return_false()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", new Mock<DbProviderFactory>().Object.GetType(), "dbo");

            Assert.NotEqual(defaultModelCacheKey1, defaultModelCacheKey2);
        }
        public void GetHashCode_when_types_not_equal_should_return_different_values()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext2), "Foo", typeof(SqlClientFactory), "dbo");

            Assert.NotEqual(defaultModelCacheKey1.GetHashCode(), defaultModelCacheKey2.GetHashCode());
        }
        public void Equals_when_types_not_equal_should_return_false()
        {
            var defaultModelCacheKey1 = new DefaultModelCacheKey(typeof(CacheKeyContext1), "Foo", typeof(SqlClientFactory), "dbo");
            var defaultModelCacheKey2 = new DefaultModelCacheKey(typeof(CacheKeyContext2), "Foo", typeof(SqlClientFactory), "dbo");

            Assert.NotEqual(defaultModelCacheKey1, defaultModelCacheKey2);
        }
Example #17
0
 private bool Equals(DefaultModelCacheKey other)
 {
     if (this._contextType == other._contextType && string.Equals(this._providerName, other._providerName) && object.Equals((object)this._providerType, (object)other._providerType))
     {
         return(string.Equals(this._customKey, other._customKey));
     }
     return(false);
 }
Example #18
0
        private bool Equals(DefaultModelCacheKey other)
        {
            DebugCheck.NotNull(other);

            return(_contextType == other._contextType &&
                   string.Equals(_providerName, other._providerName) &&
                   string.Equals(_customKey, other._customKey));
        }
        private bool Equals(DefaultModelCacheKey other)
        {
            Contract.Requires(other != null);

            return _contextType == other._contextType
                   && string.Equals(_providerName, other._providerName)
                   && string.Equals(_schema, other._schema);
        }
        private bool Equals(DefaultModelCacheKey other)
        {
            DebugCheck.NotNull(other);

            return _contextType == other._contextType
                   && string.Equals(_providerName, other._providerName)
                   && Equals(_providerType, other._providerType)
                   && string.Equals(_customKey, other._customKey);
        }
Example #21
0
        public override bool Equals(object obj)
        {
            if (object.ReferenceEquals((object)null, obj))
            {
                return(false);
            }
            if (object.ReferenceEquals((object)this, obj))
            {
                return(true);
            }
            DefaultModelCacheKey other = obj as DefaultModelCacheKey;

            if (other != null)
            {
                return(this.Equals(other));
            }
            return(false);
        }