Пример #1
0
        private bool Equals(CompositeEntityKey other)
        {
            if (_entityType != other._entityType)
            {
                return(false);
            }

            var parts      = _keyValueParts;
            var otherParts = other._keyValueParts;

            var partCount = parts.Length;

            if (partCount != otherParts.Length)
            {
                return(false);
            }

            for (var i = 0; i < partCount; i++)
            {
                if (!StructuralComparisons.StructuralEqualityComparer.Equals(parts[i], otherParts[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #2
0
        private bool Equals(CompositeEntityKey other)
        {
            if (_entityType != other._entityType)
            {
                return false;
            }

            var parts = _keyValueParts;
            var otherParts = other._keyValueParts;

            var partCount = parts.Length;
            if (partCount != otherParts.Length)
            {
                return false;
            }

            for (var i = 0; i < partCount; i++)
            {
                if (!StructuralComparisons.StructuralEqualityComparer.Equals(parts[i], otherParts[i]))
                {
                    return false;
                }
            }

            return true;
        }
        public void Base_class_value_property_returns_same_as_strongly_typed_value_property()
        {
            var key = new CompositeEntityKey(new Mock<IEntityType>().Object, new object[] { 77, "Kake" });

            Assert.Equal(new object[] { 77, "Kake" }, key.Value);
            Assert.Equal(new object[] { 77, "Kake" }, (object[])((EntityKey)key).Value);
        }
Пример #4
0
        public void Base_class_value_property_returns_same_as_strongly_typed_value_property()
        {
            var key = new CompositeEntityKey(new Mock <IEntityType>().Object, new object[] { 77, "Kake" });

            Assert.Equal(new object[] { 77, "Kake" }, key.Value);
            Assert.Equal(new object[] { 77, "Kake" }, (object[])((EntityKey)key).Value);
        }
 private bool Equals(CompositeEntityKey other)
 {
     return(EntityType == other.EntityType &&
            _keyValueParts.SequenceEqual(other._keyValueParts));
 }