コード例 #1
0
        public void Ensure_That_We_Can_Post_An_Edit_To_A_Document()
        {
            var document = PopulateDatabaseWithSingleDocument("Test");
            var client = new HttpClient(Server);

            var data = new DocumentEditRequest
                {
                    Patches = Patches.Make("Test", "Test2").ToArray(),
                    DocumentId = document.Id,
                    RevisionId = document.CurrentRevision.Id
                };

            var request = client.PutAsJsonAsync(Url + "/api/documents/1", data);
            var result = request.Result;
            //sAssert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.OK));
        }
        public void Ensure_When_Execute_An_AddRevisionToDocumentCommand_The_Document_Has_Revised_Contents()
        {
            var document = new Document("Test");
            Session.Store(document);

            var revisionDTO = new DocumentEditRequest
            {
                DocumentId = document.Id,
                ParentRevisionId = document.CurrentRevision.Id,
                RevisionId = Guid.NewGuid(),
                Patches = Patches.Make(document.Contents, "Test changed").ToArray()
            };

            var command = new AddRevisionToDocumentCommand(revisionDTO);

            ExecuteCommand(command);

            Assert.That(document.Contents, Is.EqualTo("Test changed"));
        }
コード例 #3
0
 public AddRevisionToDocumentCommand(DocumentEditRequest revision)
 {
     _documentEditRequest = revision;
 }