public void should_send_routing_key_exception() { var msg = new FakeRoutableCommand(0, null); var exception = Assert.Throws<InvalidOperationException>(() => BindingKey.Create(msg)); exception.Message.ShouldContain(typeof(FakeRoutableCommand).Name); exception.Message.ShouldContain("Name"); exception.Message.ShouldContain("can not be null"); }
public void should_get_routing_key_from_message() { using (new CultureScope(CultureInfo.GetCultureInfo("FR-fr"))) { var message = new FakeRoutableCommand(42.42m, "name", Guid.NewGuid()); var rountingKey = BindingKey.Create(message); rountingKey.PartCount.ShouldEqual(3); rountingKey.GetPart(0).ShouldEqual("42.42"); rountingKey.GetPart(1).ShouldEqual("name"); rountingKey.GetPart(2).ShouldEqual(message.OtherId.ToString()); } }
public void should_not_get_peer_with_non_matching_subscrition_binding_key() { _bus.AddHandler<RegisterPeerCommand>(x => new RegisterPeerResponse(new PeerDescriptor[0])); var command = new FakeRoutableCommand(10, "name"); var subscriptions = new[] { new Subscription(command.TypeId(), new BindingKey("5", "#")) }; _directory.Register(_bus, _self, subscriptions); _directory.GetPeersHandlingMessage(command).ShouldBeEmpty(); }