public T AndReturn<T>() { Core.StubAction action = stub.NextReturnAction(arguments); if (action == null) return default(T); else { object returnValue = action.Return(arguments); if(returnValue is T) return (T)action.Return(arguments); else throw new Exceptions.StubbingException(returnValue.GetType(), typeof(T)); } }
public Core.StubAction NextReturnAction(params object[] arguments) { List <Core.StubAction> returnList = FindReturnList(arguments); if (returnList.Count <= 0) { return(null); } Core.StubAction action = returnList[0]; returnList.RemoveAt(0); return(action); }
public void AndExecute() { Core.StubAction action = stub.NextReturnAction(arguments); if (action != null) action.Return(arguments); }
public Core.OngoingStubbing Do(Core.StubAction action) { returns.Add(action); return(ongoingStubbing); }
public Always(Core.StubAction previous, List <Core.StubAction> returns) { this.previous = previous; this.returns = returns; }