private static bool FilterOutExtensionMethods(IMemberMatcher matcher) { var methodInfo = matcher.MemberInfo as MethodInfo; return((methodInfo == null) || (!methodInfo.IsDefined(typeof(ExtensionAttribute), true))); }
private StepDescription Describe(IMemberMatcher matcher) { var def = new StepDefinition { DeclaringType = typeof(ExampleContext), Matcher = matcher }; return(new StepDescriber().Describe(def)); }
private StepDefinition BuildStepDefinition(Type type, IMemberMatcher memberMatcher, int levels) { var stepDefinition = new StepDefinition { DeclaringType = type, Matcher = memberMatcher }; if (levels > 0 && memberMatcher.ReturnType != null && memberMatcher.ReturnType != typeof (void)) stepDefinition.Children = GetStepsForType(memberMatcher.ReturnType, levels - 1, x=>true); else stepDefinition.Children = new StepDefinition[0]; return stepDefinition; }
private StepDefinition BuildStepDefinition(Type type, IMemberMatcher memberMatcher, int levels) { var stepDefinition = new StepDefinition { DeclaringType = type, Matcher = memberMatcher }; if (levels > 0 && memberMatcher.ReturnType != null && memberMatcher.ReturnType != typeof(void)) { stepDefinition.Children = GetStepsForType(memberMatcher.ReturnType, levels - 1, x => true); } else { stepDefinition.Children = new StepDefinition[0]; } return(stepDefinition); }
public IEnumerable<MemberReference> FindMembers(AssemblyDefinition assembly, IMemberMatcher matcher) { foreach (TypeDefinition type in assembly.MainModule.Types) { foreach (PropertyDefinition property in type.Properties) { if (matcher.Includes(property)) { yield return property; } } foreach (MethodDefinition method in type.Methods) { if (matcher.Includes(method)) { yield return method; } } } }
public IResult <T> Add(IResult <T> result, IMemberMatcher matcher) => new MultipleResults <T>(matcher) .Add(this, matcher) .Add(result, matcher);
internal SetupNotFoundException(IMemberMatcher message) : base(message.ToString()) { }
private StepDescription Describe(IMemberMatcher matcher) { var def = new StepDefinition { DeclaringType = typeof(ExampleContext), Matcher = matcher }; return new StepDescriber().Describe(def); }
public override IResult <Void> Add(IResult <Void> result, IMemberMatcher matcher) => result;
public Setup(IIntercept <T> interceptor, IMemberMatcher expression, IResult <TResult> result) { _interceptor = interceptor; Expression = expression; Result = result; }
private Setup <T, Void> Action(IMemberMatcher matcher) => new Setup <T, Void>(this, matcher, new ActionResult());
private static bool FilterOutExtensionMethods(IMemberMatcher matcher) { var methodInfo = matcher.MemberInfo as MethodInfo; return (methodInfo == null) || (!methodInfo.IsDefined(typeof (ExtensionAttribute), true)); }
public UninitializedResult(IMemberMatcher expression) =>
public IEnumerable <MemberReference> FindMembers(AssemblyDefinition assembly, IMemberMatcher matcher) { foreach (TypeDefinition type in assembly.MainModule.Types) { foreach (PropertyDefinition property in type.Properties) { if (matcher.Includes(property)) { yield return(property); } } foreach (MethodDefinition method in type.Methods) { if (matcher.Includes(method)) { yield return(method); } } } }
private Setup <T, TResult> Uninitialized <TResult>(IMemberMatcher matcher) => new Setup <T, TResult>(this, matcher, new UninitializedResult <TResult>(matcher));
internal OutOfResultsException(IMemberMatcher expression) : base(expression.ToString()) { }
public MultipleResults(IMemberMatcher expression) =>
public SetupAsync(IIntercept <T> interceptor, IMemberMatcher expression) : base(interceptor, expression, new UninitializedResult <Task <TResult> >(expression)) { }
internal UninitializedException(IMemberMatcher message) : base(message.ToString()) { }
public ISetup <TResult> Load <TResult>(IMemberMatcher m) { return(_setups.TryGetValue(m, out var setup) ? (ISetup <TResult>)setup : throw new SetupNotFoundException(m)); }
public override IResult <Task> Add(IResult <Task> result, IMemberMatcher matcher) => result;
private Setup <T, Task> AsyncAction(IMemberMatcher matcher) => new Setup <T, Task>(this, matcher, new AsyncActionResult());