public void Should_throw_if_http_error()
        {
            var projectionName = Guid.NewGuid().ToString();
            var projectionContent = Guid.NewGuid().ToString();

            var response = new HttpResponse(HttpStatusCode.InternalServerError, String.Empty, String.Empty);

            var httpClient = new FakeHttpClient(u => response, (u, d) => response, (u, d) => response);
            var counter = new CountdownEvent(1);
            httpClient.SetCounter(counter);

            var manager = new ProjectionsManager(EventStoreAddress, httpClient);

            manager.GetConfigAsync(projectionName);

            Assert.IsTrue(counter.Wait(3000));
        }
        public void Should_update_existing_projection()
        {
            var projectionName = Guid.NewGuid().ToString();
            var projectionContent = Guid.NewGuid().ToString();

            var httpClient = new FakeHttpClient(u => new HttpResponse(HttpStatusCode.OK, String.Empty, String.Empty), null, null);
            var manager = new ProjectionsManager(EventStoreAddress, httpClient);

            var counter = new CountdownEvent(1);
            httpClient.SetCounter(counter);

            manager.UpdateProjectionQueryAsync(projectionName, projectionContent);

            Assert.IsTrue(counter.Wait(3000));

            CollectionAssert.IsEmpty(httpClient.PostRequests);
            CollectionAssert.IsEmpty(httpClient.GetRequests);
            CollectionAssert.IsNotEmpty(httpClient.PutRequests);

            StringAssert.Contains(projectionName, httpClient.PutRequests[0].Url);
        }