public void Outgoing_databus_properties_should_be_dehydrated()
        {
            var message = new MessageWithDataBusProperty
                              {
                                  DataBusProperty = new DataBusProperty<string>("test")
                              };

            outgoingMutator.MutateOutgoing(message);

            dataBus.AssertWasCalled(
                x => x.Put(Arg<Stream>.Is.Anything, Arg<TimeSpan>.Is.Equal(TimeSpan.MaxValue)));
        }
Exemple #2
0
        public void Outgoing_databus_properties_should_be_dehydrated()
        {
            var message = new MessageWithDataBusProperty
            {
                DataBusProperty = new DataBusProperty <string>("test")
            };


            outgoingMutator.MutateOutgoing(message);

            dataBus.AssertWasCalled(
                x => x.Put(Arg <Stream> .Is.Anything, Arg <TimeSpan> .Is.Equal(TimeSpan.MaxValue)));
        }
        public void Incoming_databus_properties_should_be_hydrated()
        {
            var message = new MessageWithDataBusProperty
                              {
                                  DataBusProperty = new DataBusProperty<string>("not used in this test")
                              };
            message.DataBusProperty.Key = Guid.NewGuid().ToString();

            var databusKey = Guid.NewGuid().ToString();

            message.SetHeader("NServiceBus.DataBus." + message.DataBusProperty.Key, databusKey);

            using (var stream = new MemoryStream())
            {
                new BinaryFormatter().Serialize(stream, "test");
                stream.Position = 0;

                dataBus.Stub(s => s.Get(databusKey)).Return(stream);

                message = (MessageWithDataBusProperty) incomingMutator.MutateIncoming(message);
            }
            Assert.AreEqual(message.DataBusProperty.Value, "test");
        }
Exemple #4
0
        public void Incoming_databus_properties_should_be_hydrated()
        {
            var message = new MessageWithDataBusProperty
            {
                DataBusProperty = new DataBusProperty <string>("not used in this test")
            };

            message.DataBusProperty.Key = Guid.NewGuid().ToString();

            var databusKey = Guid.NewGuid().ToString();

            message.SetHeader("NServiceBus.DataBus." + message.DataBusProperty.Key, databusKey);

            using (var stream = new MemoryStream())
            {
                new BinaryFormatter().Serialize(stream, "test");
                stream.Position = 0;

                dataBus.Stub(s => s.Get(databusKey)).Return(stream);

                message = (MessageWithDataBusProperty)incomingMutator.MutateIncoming(message);
            }
            Assert.AreEqual(message.DataBusProperty.Value, "test");
        }