public void WithValidatorMethodTest() { OperationsHeuristic heuristic = new OperationsHeuristic(); Type type = typeof(WithValidator); MethodInfo method = type.GetMethod("SomethingIsValid"); bool selectable = heuristic.IsSelectable(method); Assert.That(selectable, Is.True); }
public void WithNoOperationsTest() { OperationsHeuristic heuristic = new OperationsHeuristic(); Type type = typeof(Simple); MethodInfo[] methods = type.GetMethods(); bool selectable = heuristic.IsSelectable(methods[0]); Assert.That(selectable, Is.False); }
public void ValidatorPrecedenceOverOperations() { OperationsHeuristic heuristic = new OperationsHeuristic(); ValidatorHeuristic validatorHeuristic = new ValidatorHeuristic(); Type type = typeof(WithValidator); MethodInfo method = type.GetMethod("SomethingIsValid"); bool hasPrecedence = validatorHeuristic.HasPrecedence(heuristic, method); Assert.That(hasPrecedence, Is.True); }
public void EnablerPrecedenceOverOperations() { OperationsHeuristic heuristic = new OperationsHeuristic(); EnablerHeuristic enablerHeuristic = new EnablerHeuristic(); Type type = typeof(WithEnabler); MethodInfo method = type.GetMethod("CanDoSomething"); bool hasPrecedence = enablerHeuristic.HasPrecedence(heuristic, method); Assert.That(hasPrecedence, Is.True); }