public async Task Process_ErrorResponse_ReturnsResponseFromHandler()
        {
            var session          = CreateSession();
            var expectedResponse = ApiResponse.Error <QueryMockResult>(new TestError());
            var query            = StructQueryHandlerMock.GetQuery(expectedResponse);

            var actualResponse = await session.ProcessStructQuery(query, Returns <QueryMockResult> .Type);

            Assert.Equal(expectedResponse, actualResponse);
        }
        public async Task Process_SuccessfulResponse_ReturnsResponseFromHandler()
        {
            var session = CreateSession();

            var(query, expectedResponse) = StructQueryHandlerMock.GetQuery();

            var actualResponse = await session.ProcessStructQuery(query, Returns <QueryMockResult> .Type);

            Assert.Equal(expectedResponse, actualResponse);
        }
        public async Task Process_ExecutePipelineAndPassQueryInContext()
        {
            var session = CreateSession();

            var(query, _) = StructQueryHandlerMock.GetQuery();

            await session.ProcessStructQuery(query, Returns <QueryMockResult> .Type);

            CatchQueryPipelineStep.AssertContextCaptured <StructQueryMock, QueryMockResult>(
                context => context.Query.Equals(query));
        }
        public async Task Process_ExecutePipelineAndPassConnectionInContext()
        {
            var session = CreateSession();

            var(query, _) = StructQueryHandlerMock.GetQuery();

            await session.ProcessStructQuery(query, Returns <QueryMockResult> .Type);

            CatchQueryPipelineStep.AssertContextCaptured <StructQueryMock, QueryMockResult>(

                // ReSharper disable once IsExpressionAlwaysTrue
                context => context.Connection is HattemSessionMock);
        }