protected override void Given()
 {
     Context += CouchDbContext.Configure;
     Context += () =>
                     {
                         _eventPersister = new EventPersister(new WebRequestGateway(), CouchDbContext.DatabaseDetails);
                         _eventHistoryLoader = new EventHistoryLoader(new WebRequestGateway(), new DocumentToEventsMapper(), CouchDbContext.DatabaseDetails);
                         _aggregateId = AggregateIdGenerator.Generate();
                         _testEvents = new EventsSpy(new AggregateEvent(_aggregateId), new AggregateEvent(_aggregateId));
                     };
 }
        protected override void Given()
        {
            Context += () =>
                           {
                               _httpWebResponse = new Mock<IHttpWebResponse>(MockBehavior.Loose);
                               _httpWebResponse.Setup(r => r.StatusCode).Returns(HttpStatusCode.BadRequest);
                               _gateway = new Mock<IAmAGatewayForWebRequests>(MockBehavior.Loose);
                               _gateway.Setup(g => g.SafelyMakeRequest(It.IsAny<HttpWebRequest>()))
                                   .Returns(new CouchDbResponse(_httpWebResponse.Object));

                               _sut = new EventPersister(_gateway.Object, new CouchDbDatabaseDetailsBuilder("TestDatabase", "http://127.0.0.1/", "Foo", "Bar").Build());
                               _aggregateId = AggregateIdGenerator.Generate();
                               _eventsSpy = new EventsSpy(new AggregateEvent(_aggregateId),
                                                          new AggregateEvent(_aggregateId),
                                                          new AggregateEvent(_aggregateId));
                           };
        }