/// <summary> /// Executes the query /// </summary> /// <param name="query">the query</param> /// <returns>result of the query</returns> public Task <CrichtonRepresentor> ExecuteQueryAsync(IHypermediaQuery query) { if (query == null) { throw new ArgumentNullException("query"); } return(query.ExecuteAsync(TransitionRequestHandler)); }
public async Task ExecuteAsync_ReturnsResultOfChainedCallsToSteps() { var requestor = Fixture.Create <ITransitionRequestHandler>(); var step1 = MockRepository.GenerateMock <IQueryStep>(); var step1Result = Fixture.Create <CrichtonRepresentor>(); step1.Stub(s => s.ExecuteAsync(null, requestor)).Return(Task.FromResult(step1Result)); var step2 = MockRepository.GenerateMock <IQueryStep>(); var step2Result = Fixture.Create <CrichtonRepresentor>(); step2.Stub(s => s.ExecuteAsync(step1Result, requestor)).Return(Task.FromResult(step2Result)); sut.Steps.Add(step1); sut.Steps.Add(step2); var result = await sut.ExecuteAsync(requestor); Assert.AreEqual(step2Result, result); }