public void given_empty_when_write_message()
        {
            var write  = Message.Create("test", RandBytes(200));
            var result = Writer.Append(new[] { write });

            Assert.AreNotEqual(0, result.Position);
            Assert.AreEqual(result.Position, Writer.GetPosition());
            Assert.AreEqual(result.Position, CheckpointReader.Read());
        }
Exemple #2
0
        public async Task <IProjection> Create(Type type)
        {
            var pi   = GetProjectionInfo(type);
            var proj = new Projection();

            proj.Name = pi.Name;
            proj.SubscriptionStreamName = pi.SubscriptionStreamName;
            ICheckpointReader cr = Provider.GetRequiredService <ICheckpointReader>();

            proj.Checkpoint = await cr.Read($"Checkpoints-{proj.Name}");

            ICheckpointWriter cw = Provider.GetRequiredService <ICheckpointWriter>();

            proj.CheckpointWriter = cw;
            proj.Subscription     = CreateSubscription(proj);
            proj.Handlers         = GetHandlers(type);
            return(proj);
        }
 public long GetPosition()
 {
     return(Position.Read());
 }