public void Equals_DoesntCall_OverriddenEqualsOnTheType()
        {
            TypeThatOverridesEquals t1 = new TypeThatOverridesEquals();
            TypeThatOverridesEquals t2 = new TypeThatOverridesEquals();

            Assert.DoesNotThrow(() => ReferenceEqualityComparer.Instance.Equals(t1, t2));
        }
        public void Equals_DoesntCall_OverriddenEqualsOnTheType()
        {
            var t1 = new TypeThatOverridesEquals();
            var t2 = new TypeThatOverridesEquals();

            Assert.DoesNotThrow(() => ReferenceEqualityComparer.Instance.Equals(t1, t2));
        }
        public void Equals_DoesntCall_OverriddenEqualsOnTheType()
        {
            var t1 = new TypeThatOverridesEquals();
            var t2 = new TypeThatOverridesEquals();

            // Act & Assert (does not throw)
            ReferenceEqualityComparer.Instance.Equals(t1, t2);
        }
示例#4
0
        public void Equals_DoesntCall_OverriddenEqualsOnTheType()
        {
            var t1 = new TypeThatOverridesEquals();
            var t2 = new TypeThatOverridesEquals();

            // Act & Assert (does not throw)
            ReferenceEqualityComparer.Instance.Equals(t1, t2);
        }
        public void Validate_DoesNotUseOverridden_GetHashCodeOrEquals()
        {
            // Arrange
            var actionContext   = new ActionContext();
            var modelState      = actionContext.ModelState;
            var validationState = new ValidationStateDictionary();

            var validator = CreateValidator();

            var model = new TypeThatOverridesEquals[]
            {
                new TypeThatOverridesEquals {
                    Funny = "hehe"
                },
                new TypeThatOverridesEquals {
                    Funny = "hehe"
                }
            };

            // Act & Assert (does not throw)
            validator.Validate(actionContext, validationState, string.Empty, model);
        }
        public void Validate_DoesNotUseOverridden_GetHashCodeOrEquals()
        {
            // Arrange
            var validatorProvider = CreateValidatorProvider();
            var modelState = new ModelStateDictionary();
            var validationState = new ValidationStateDictionary();

            var validator = CreateValidator();

            var model = new TypeThatOverridesEquals[]
            {
                new TypeThatOverridesEquals { Funny = "hehe" },
                new TypeThatOverridesEquals { Funny = "hehe" }
            };

            // Act & Assert (does not throw)
            validator.Validate(validatorProvider, modelState, validationState, string.Empty, model);
        }