Пример #1
0
        public async Task 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", "#")) };
            await _directory.RegisterAsync(_bus, _self, subscriptions).ConfigureAwait(true);

            _directory.GetPeersHandlingMessage(command).ShouldBeEmpty();
        }
Пример #2
0
        public void should_get_peer_with_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("10", "#")) };

            _directory.Register(_bus, _self, subscriptions);

            var peerHandlingMessage = _directory.GetPeersHandlingMessage(command).Single();

            peerHandlingMessage.Id.ShouldEqual(_self.Id);
        }