Ejemplo n.º 1
0
        public void when_wrapping_message_that_does_not_have_version1_wrapper_should_use_version2_wrapper()
        {
            var msg = new ClientMessage.DeleteStream(Guid.NewGuid(), Guid.NewGuid(), _envelope, true, "test-stream",
                                                     ExpectedVersion.Any, false, SystemAccount.Principal);
            var package = _dispatcher.WrapMessage(msg, _version);

            Assert.IsNotNull(package, "Package");
            Assert.AreEqual(TcpCommand.DeleteStream, package.Value.Command);

            var dto = package.Value.Data.Deserialize <TcpClientMessageDto.DeleteStream>();

            Assert.IsNotNull(dto, "DTO is null");
        }
Ejemplo n.º 2
0
        when_wrapping_read_stream_events_forward_and_stream_was_deleted_should_not_downgrade_last_event_number_for_v2_clients()
        {
            var msg = new ClientMessage.ReadStreamEventsForwardCompleted(Guid.NewGuid(), "test-stream", 0, 100,
                                                                         ReadStreamResult.StreamDeleted, new ResolvedEvent[0], new StreamMetadata(),
                                                                         true, "", -1, long.MaxValue, true, 1000);

            var package = _dispatcher.WrapMessage(msg, (byte)ClientVersion.V2);

            Assert.IsNotNull(package, "Package is null");
            Assert.AreEqual(TcpCommand.ReadStreamEventsForwardCompleted, package.Value.Command, "TcpCommand");

            var dto = package.Value.Data.Deserialize <ReadStreamEventsCompleted>();

            Assert.IsNotNull(dto, "DTO is null");

            Assert.AreEqual(long.MaxValue, dto.LastEventNumber, "Last Event Number");
        }