Exemple #1
0
        protected override void WriteTestScenario()
        {
            _event1 = WriteStreamCreated("ES");

            long pos;

            var prepare1 = LogRecord.SingleWrite(WriterChecksum.ReadNonFlushed(),    // prepare1
                                                 Guid.NewGuid(),
                                                 Guid.NewGuid(),
                                                 "ES",
                                                 0,
                                                 "some-type",
                                                 LogRecord.NoData,
                                                 null,
                                                 DateTime.UtcNow);

            Assert.IsTrue(Writer.Write(prepare1, out pos));

            var prepare2 = LogRecord.SingleWrite(WriterChecksum.ReadNonFlushed(),    // prepare2
                                                 Guid.NewGuid(),
                                                 Guid.NewGuid(),
                                                 "ES",
                                                 0,
                                                 "some-type",
                                                 LogRecord.NoData,
                                                 null,
                                                 DateTime.UtcNow);

            Assert.IsTrue(Writer.Write(prepare2, out pos));


            var deletePrepare = LogRecord.DeleteTombstone(WriterChecksum.ReadNonFlushed(),  // delete prepare
                                                          Guid.NewGuid(),
                                                          "ES",
                                                          0);

            Assert.IsTrue(Writer.Write(deletePrepare, out pos));

            var prepare3 = LogRecord.SingleWrite(WriterChecksum.ReadNonFlushed(),     // prepare3
                                                 Guid.NewGuid(),
                                                 Guid.NewGuid(),
                                                 "ES",
                                                 0,
                                                 "some-type",
                                                 LogRecord.NoData,
                                                 null,
                                                 DateTime.UtcNow);

            Assert.IsTrue(Writer.Write(prepare3, out pos));

            var commit = LogRecord.Commit(WriterChecksum.ReadNonFlushed(),     // committing delete
                                          deletePrepare.CorrelationId,
                                          deletePrepare.LogPosition,
                                          EventNumber.DeletedStream);

            Assert.IsTrue(Writer.Write(commit, out pos));
        }
Exemple #2
0
        protected override void WriteTestScenario()
        {
            _event1 = WriteStreamCreated("ES");
            _event2 = WriteSingleEvent("ES", 1, "bla1");

            var  prepare = LogRecord.DeleteTombstone(WriterChecksum.ReadNonFlushed(), Guid.NewGuid(), "ES", 2);
            long pos;

            Assert.IsTrue(Writer.Write(prepare, out pos));

            _event3 = WriteSingleEvent("ES", 2, "bla1");
            Scavenge();
        }