protected void Given_EHL_API_is_not_working()
        {
            var testServer = new HttpTestServerBuilder()
                             .WithUnsuccessfulResponse()
                             .Create();

            _containerBuilder.RegisterInstance(testServer.Handler);
            _container = _containerBuilder.Build();
        }
        private static TestServer HttpTestServer(Dictionary <string, string> stubbedGetResponse, Dictionary <string, string> stubbedPostResponse)
        {
            var testServer = new HttpTestServerBuilder()
                             .WithCallbackForResponse(
                context =>
            {
                var stubbedResponse = context.Request.Method.ToUpperInvariant() == "GET"
                            ? stubbedGetResponse
                            : stubbedPostResponse;

                var response = stubbedResponse
                               .First(x => context.Request.Uri.ToString().Contains(x.Key)).Value;

                context.Response.WriteAsync(response).Wait();
            })
                             .Create();

            return(testServer);
        }
        protected void Given_EHL_API_is_working_correctly_with_invalid_futuresupplies()
        {
            var stubbedGetResponse  = GetStubbedResponsesFrom(InvalidFutureSupplyStubbedGetRequests);
            var stubbedPostResponse = GetStubbedResponsesFrom(StubbedResponseFilenamesForPostRequests);

            var testServer = new HttpTestServerBuilder()
                             .WithCallbackForResponse(
                context =>
            {
                var stubbedResponse = context.Request.Method.ToUpperInvariant() == "GET"
                            ? stubbedGetResponse
                            : stubbedPostResponse;

                var response = stubbedResponse
                               .First(x => context.Request.Uri.ToString().Contains(x.Key)).Value;

                context.Response.WriteAsync(response).Wait();
            })
                             .WithCallbackForRequest((_, req) => { RequestCollection.Add(req); })
                             .Create();

            _containerBuilder.RegisterInstance(testServer.Handler);
            _container = _containerBuilder.Build();
        }