Exemplo n.º 1
0
        private GuaranteedDeliverySnapshot SnapshotFrom(byte[] bytes)
        {
            var snap = AtLeastOnceDeliverySnapshot.ParseFrom(bytes);
            var unconfirmedDeliveries = new UnconfirmedDelivery[snap.UnconfirmedDeliveriesCount];

            for (int i = 0; i < snap.UnconfirmedDeliveriesCount; i++)
            {
                var unconfirmed = snap.UnconfirmedDeliveriesList[i];
                var unconfirmedDelivery = new UnconfirmedDelivery(
                    deliveryId: unconfirmed.DeliveryId,
                    destination: ActorPath.Parse(unconfirmed.Destination),
                    message: PayloadFromProto(unconfirmed.Payload));
                unconfirmedDeliveries[i] = unconfirmedDelivery;
            }

            return new GuaranteedDeliverySnapshot(snap.CurrentDeliveryId, unconfirmedDeliveries);
        }
Exemplo n.º 2
0
        public void MessageSerializer_when_given_AtLeastOnceDeliverySnapshot_should_handle_empty_unconfirmed()
        {
            var unconfirmed = new UnconfirmedDelivery[0];
            var snap = new AtLeastOnceDeliverySnapshot(13, unconfirmed);
            var serializer = _serialization.FindSerializerFor(snap);

            var bytes = serializer.ToBinary(snap);
            var deserialized = serializer.FromBinary(bytes, typeof (AtLeastOnceDeliverySnapshot));

            deserialized.ShouldBe(snap);
        }