|
@@ -1,4 +1,6 @@
|
|
|
using System;
|
|
|
+using System.Collections;
|
|
|
+using System.Collections.Generic;
|
|
|
using Abc.Zebus.Directory;
|
|
|
using Abc.Zebus.Routing;
|
|
|
using Abc.Zebus.Testing.Extensions;
|
|
@@ -24,6 +26,18 @@ namespace Abc.Zebus.Tests.Routing
|
|
|
messageBinding.RoutingContent[2].ShouldEqual(new RoutingContentValue(message.OtherId.ToString()));
|
|
|
}
|
|
|
|
|
|
+ [Test]
|
|
|
+ public void should_create_message_binding_from_message_with_null_value()
|
|
|
+ {
|
|
|
+ var message = new FakeRoutableCommandWithString { Id = null };
|
|
|
+
|
|
|
+ var messageBinding = MessageBinding.FromMessage(message);
|
|
|
+
|
|
|
+ messageBinding.MessageTypeId.ShouldEqual(MessageUtil.TypeId<FakeRoutableCommandWithString>());
|
|
|
+ messageBinding.RoutingContent.PartCount.ShouldEqual(1);
|
|
|
+ messageBinding.RoutingContent[0].ShouldEqual(new RoutingContentValue((string)null));
|
|
|
+ }
|
|
|
+
|
|
|
[Test, SetCulture("FR-fr")]
|
|
|
public void should_create_message_binding_from_message_with_collections()
|
|
|
{
|
|
@@ -43,6 +57,36 @@ namespace Abc.Zebus.Tests.Routing
|
|
|
messageBinding.RoutingContent[2].ShouldEqual(new RoutingContentValue(new[] { "1.5" }));
|
|
|
}
|
|
|
|
|
|
+ [Test]
|
|
|
+ public void should_create_message_binding_from_message_with_null_collection_items()
|
|
|
+ {
|
|
|
+ var message = new FakeRoutableCommandWithStringCollection
|
|
|
+ {
|
|
|
+ Ids = new() { "1", null, "2" },
|
|
|
+ };
|
|
|
+
|
|
|
+ var messageBinding = MessageBinding.FromMessage(message);
|
|
|
+
|
|
|
+ messageBinding.MessageTypeId.ShouldEqual(MessageUtil.TypeId<FakeRoutableCommandWithStringCollection>());
|
|
|
+ messageBinding.RoutingContent.PartCount.ShouldEqual(1);
|
|
|
+ messageBinding.RoutingContent[0].ShouldEqual(new RoutingContentValue(new[] { "1", null, "2" }));
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void should_create_message_binding_from_message_with_null_collection()
|
|
|
+ {
|
|
|
+ var message = new FakeRoutableCommandWithStringCollection
|
|
|
+ {
|
|
|
+ Ids = null,
|
|
|
+ };
|
|
|
+
|
|
|
+ var messageBinding = MessageBinding.FromMessage(message);
|
|
|
+
|
|
|
+ messageBinding.MessageTypeId.ShouldEqual(MessageUtil.TypeId<FakeRoutableCommandWithStringCollection>());
|
|
|
+ messageBinding.RoutingContent.PartCount.ShouldEqual(1);
|
|
|
+ messageBinding.RoutingContent[0].ShouldEqual(new RoutingContentValue(Array.Empty<string>()));
|
|
|
+ }
|
|
|
+
|
|
|
[Test]
|
|
|
public void should_create_message_binding_from_message_with_properties()
|
|
|
{
|
|
@@ -76,5 +120,19 @@ namespace Abc.Zebus.Tests.Routing
|
|
|
[RoutingPosition(2)]
|
|
|
public int FeedId { get; set; }
|
|
|
}
|
|
|
+
|
|
|
+ [Routable]
|
|
|
+ public class FakeRoutableCommandWithString : ICommand
|
|
|
+ {
|
|
|
+ [RoutingPosition(1)]
|
|
|
+ public string Id { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
+ [Routable]
|
|
|
+ public class FakeRoutableCommandWithStringCollection : ICommand
|
|
|
+ {
|
|
|
+ [RoutingPosition(1)]
|
|
|
+ public List<string> Ids { get; set; }
|
|
|
+ }
|
|
|
}
|
|
|
}
|