private void When(DocumentDescriptorCreated e) { CreationDocumentHandleInfo = e.HandleInfo; Created = true; }
public void verify_id_is_sequential() { rmStream.Add(new StreamReadModel() { Id = 41 }); rmDocuments.Add(new DocumentDescriptorReadModel( 1L, new DocumentDescriptorId(1), new BlobId("blob.1")) { Created = true }); CreateSut(); var evt = new DocumentDescriptorCreated(new BlobId("blob.1"), new DocumentHandleInfo(new DocumentHandle("rev_1"), new FileNameWithExtension("test.txt"))) .AssignIdForTest(new DocumentDescriptorId(1)); _sut.Handle(evt, false); Assert.That(rmStream, Has.Count.EqualTo(2)); Assert.That(rmStream[1].Id, Is.EqualTo(42)); }
public void verify_id_when_empty_projection() { CreateSut(); rmDocuments.Add(new DocumentDescriptorReadModel( 1L, new DocumentDescriptorId(1), new BlobId("blob.1")) { Created = true }); var evt = new DocumentDescriptorCreated( new BlobId("original.1"), new DocumentHandleInfo(new DocumentHandle("Rev_1"), new FileNameWithExtension("test.txt"))) .AssignIdForTest(new DocumentDescriptorId(1)); _sut.Handle(evt, false); Assert.That(rmStream, Has.Count.EqualTo(1)); Assert.That(rmStream[0].Id, Is.EqualTo(1)); }
public void verify_document_descriptor_created_generates_record() { CreateSut(); rmDocuments.Add(new DocumentDescriptorReadModel(1L, new DocumentDescriptorId(1), new BlobId("original.1"))); var evtCreated = new DocumentDescriptorCreated( new BlobId("original.1"), new DocumentHandleInfo(new DocumentHandle("Rev_1"), new FileNameWithExtension("test.txt"))) .AssignIdForTest(new DocumentDescriptorId(1)); _sut.Handle(evtCreated, false); Assert.That(rmStream, Has.Count.EqualTo(1)); Assert.That(rmStream[0].EventType, Is.EqualTo(HandleStreamEventTypes.DocumentCreated)); Assert.That(rmStream[0].Handle, Is.EqualTo("rev_1")); }