public void ExplicitlyImplementedProperty_ShouldNotExist_ViaImplementingType() { var ex = Assert.Throws <ArgumentException>(() => _countPropertyConstraint.ApplyTo(_array)); Assert.That(ex, Has.Message.StartWith("Property Count was not found on System.Int32[]")); var actualExist = _countPropertyExistsConstraint.ApplyTo(_array); Assert.That(actualExist.IsSuccess, Is.False); }
public void PropertyDefinedInDerivedClass_ShouldExist() { var sut = new PropertyConstraint(nameof(Derived.SomeProperty), new EqualConstraint(42)); var instance = (Base) new Derived(); var actual = sut.ApplyTo(instance); Assert.That(actual, Has.Property(nameof(ConstraintResult.Status)).EqualTo(ConstraintStatus.Success)); var existSut = new PropertyExistsConstraint(nameof(Derived.SomeProperty)); var actualExist = existSut.ApplyTo(instance); Assert.That(actualExist.IsSuccess, Is.True); }