public void CanValidateShouldReturnFalseWhenValidationIsNotPossible() { GenericSubclassTypeValidator validator = new GenericSubclassTypeValidator(typeof(IGenericInterface<>)); Assert.That(validator.CanValidate(typeof(string)), Is.False); Assert.That(validator.CanValidate(null), Is.False); }
public void ValidateShouldNotThrowWhenGenericTypeIsGiven() { GenericSubclassTypeValidator validator = new GenericSubclassTypeValidator(typeof(IGenericInterface<>)); validator.Validate(typeof(Generic)); validator.Validate(typeof(ParentGeneric)); validator.Validate(typeof(ChildGeneric)); }
public void ValidateShouldThrowWhenNonGenericTypeIsGiven() { GenericSubclassTypeValidator validator = new GenericSubclassTypeValidator(typeof(IGenericInterface<>)); Assert.Throws<ArgumentException>(() => validator.Validate(new NotGeneric())); }
public void CanValidateShouldReturnTrueWhenValidationIsPossible() { GenericSubclassTypeValidator validator = new GenericSubclassTypeValidator(typeof(IGenericInterface<>)); Assert.That(validator.CanValidate(typeof(Type)), Is.True); }