protected override void Handle(HiMessage message) { base.Handle(message); if (IsConsumer) { _providerService.AddConsumerPeer(this); } }
public void can_add_consumer() { testConsumer = TestConsumer.ForDeposit(Keccak.Zero) .WithNode(1).AddSession().WithUnpaidUnits(10) .And.Build(); ConsumerNode consumerNode = testConsumer.Node(1).Node; INdmProviderPeer consumerPeer = consumerNode.Peer; ConsumerNode[] pre = sessionManager.GetConsumerNodes().ToArray(); bool consumerAlreadyAdded = pre.Contains(consumerNode); Assert.IsTrue(!consumerAlreadyAdded); providerService.AddConsumerPeer(consumerPeer); var addedConsumer = sessionManager.GetConsumerNodes().Where(node => node.Peer.Equals(consumerPeer)); Assert.IsTrue(addedConsumer != null); }