public void IsSatisfiedWithTwoParameters() { MethodParametersCountCriteria criteria = new MethodParametersCountCriteria(2); MethodInfo method = GetType().GetMethod("TwoParameters", BindingFlags.Public | BindingFlags.Instance); Assert.IsTrue(criteria.IsSatisfied(method)); }
public void Instantiation() { MethodParametersCountCriteria criteria = new MethodParametersCountCriteria(); Assert.AreEqual(0, criteria.ExpectedParameterCount); criteria = new MethodParametersCountCriteria(10); Assert.AreEqual(10, criteria.ExpectedParameterCount); }
public void IsSatisfiedWithNoParameter() { MethodParametersCountCriteria criteria = new MethodParametersCountCriteria(); MethodInfo method = GetType().GetMethod("NoParameter", BindingFlags.Public | BindingFlags.Instance); Assert.IsTrue(criteria.IsSatisfied(method)); criteria = new MethodParametersCountCriteria(0); method = GetType().GetMethod("NoParameter", BindingFlags.Public | BindingFlags.Instance); Assert.IsTrue(criteria.IsSatisfied(method)); criteria = new MethodParametersCountCriteria(); criteria.ExpectedParameterCount = 0; method = GetType().GetMethod("NoParameter", BindingFlags.Public | BindingFlags.Instance); Assert.IsTrue(criteria.IsSatisfied(method)); }
public void BailsWhenExpectedParameterCountSetToLessThanZero() { MethodParametersCountCriteria criteria = new MethodParametersCountCriteria(); Assert.Throws <ArgumentOutOfRangeException>(() => criteria.ExpectedParameterCount = -12); }
public void IsNotSatisfiedWithNull() { MethodParametersCountCriteria criteria = new MethodParametersCountCriteria(); Assert.IsFalse(criteria.IsSatisfied(null)); }