public void Initialize() { queryMacroParser = A.Fake<IQueryMacroParser>(); SetupQueryMacroParserFake(); shimContext = ShimsContext.Create(); tfsContext = new FakeTfsContext(shimContext); queryDefinition = new ShimQueryDefinition(); queryDefinition.QueryTextGet = () => "SELECT System.ID, System.Title from workitems"; SetupQueryShim(tfsContext); }
public void Initialize() { shimContext = ShimsContext.Create(); projectShim = new ShimProject(); projectShim.NameGet = () => "TestProject"; ShimQueryItem.AllInstances.ProjectGet = q => projectShim; var tfsContextInstance = new FakeTfsContext(shimContext); tfsContextMock = A.Fake<ITfsContext>(o => o.Wrapping(tfsContextInstance)); }
/// <summary> /// Configures a query shim to simulate Run on TFS Query objects /// </summary> private void SetupQueryShim(FakeTfsContext tfsContext) { ShimQuery.ConstructorWorkItemStoreString = (q, ws, wi) => { ShimQuery query = new ShimQuery(); query.QueryStringGet = () => wi; q = query; }; var workItem = new ShimWorkItem(); workItem.IdGet = () => 5; workItem.TitleGet = () => "Linked Work Item"; var workItemLinkInfo = new WorkItemLinkInfo(); workItemLinkInfo.TargetId = 5; tfsContext.AddWorkItem(workItem); ShimWorkItemCollection collection = SetupWorkItemCollection(workItem); ShimQuery.AllInstances.IsLinkQueryGet = (q) => false; ShimQuery.AllInstances.RunQuery = (q) => collection; ShimQuery.AllInstances.RunLinkQuery = (q) => new List<WorkItemLinkInfo>() { workItemLinkInfo }.ToArray(); }
public void Initialize() { shimsContext = ShimsContext.Create(); fakeTfsContext = new FakeTfsContext(shimsContext); }