public static T With <T>(CaptureMatch <T> match) { return(Match.Create(match)); }
public static T In <T>(ICollection <T> collection) { var match = new CaptureMatch <T>(collection.Add); return(With(match)); }
public static T In <T>(IList <T> collection, Expression <Func <T, bool> > predicate) { var match = new CaptureMatch <T>(collection.Add, predicate); return(With(match)); }
/// <summary> /// Creates a parameter capture using specified <see cref="CaptureMatch{T}"/>. /// </summary> /// <typeparam name="T">The captured object type</typeparam> /// <example> /// Arrange code: /// <code> /// var capturedValue = string.Empty; /// var match = new CaptureMatch{string}(x => capturedValue = x); /// mock.Setup(x => x.DoSomething(Capture.With(match))); /// </code> /// Assert code: /// <code> /// Assert.Equal("Hello!", capturedValue); /// </code> /// </example> public static T With <T>(CaptureMatch <T> match) { Match.Register(match); return(default(T)); }