public void ShouldPushUpdatedDocumensWithDbDocumentRevisionWithPut() { var expectedDoc = new JsonObject(docB2WithoutRev); int stage = 0; var extractorMock = new Mock<IDesignDocumentExtractor>(); extractorMock .Setup(e => e.Extract(It.IsAny<IEnumerable<JsonObject>>())) .Returns( (IEnumerable<JsonObject> _) => { switch (stage++) { case 0: return CreateDesignDocumentMap(docB); case 1: return CreateDesignDocumentMap(expectedDoc); default: throw new Exception(); } }); var handler = GetNoResultsMessageHandler(); var engine = new Engine( extractorMock.Object, Mock.Of<IDesignDocumentAssembler>(a => a.Assemble() == CreateDesignDocumentMap(docB2WithoutRev)), handler ); engine.PushIfChanged(new Uri("http://example.com/db1")); Assert.Equal("http://example.com/db1/_bulk_docs", handler.Requests[1].RequestUri.ToString()); Assert.Equal("POST", handler.Requests[1].Method.ToString()); expectedDoc["_rev"] = docB["_rev"]; Assert.Equal("{\"docs\":[" + expectedDoc + "]}", handler.RequestBodies[1], new JsonStringCompairer()); }