/// <summary> /// Sets up the mock. /// </summary> /// <remarks> /// This needs to be called after Summaries and WorkItems are set. /// Also note. this is called from BuildWorkItemLists so if you are using that to populate the lists you do not need to call this method. /// </remarks> public void SetupMock() { mockReader.Setup(m => m.GetWorkItemsAsync(It.IsAny <Func <int, bool> >())) .ReturnsAsync((Func <int, bool> predicate) => Summaries.Where(w => predicate(w.Id)).ToArray()); mockReader.Setup(m => m.GetWorkItemAsync(It.IsAny <WorkItemSummary>())) .ReturnsAsync( (WorkItemSummary x) => { foreach (var detail in WorkItems) { if (detail.WorkItem.Id == x.Id) { return(detail); } } throw new ArgumentException("Failed to find the work item"); }); }