public void TestInboundStreamInterestCreateAttributeSet()
        {
            var inboundStreamInterest =
                TestWorld.ActorFor <IInboundStreamInterest>(
                    () => new AttributesAgentActor(_localNode, Application, _outboundStream.Actor, Config, _interest));

            var message = CreateAttributeSet.From(_localNode, _set);

            inboundStreamInterest.Actor.HandleInboundStreamMessage(AddressType.Op, RawMessageFor(_localNodeId, _localNode.Name, message));

            var channel1 = _channelProvider.ChannelFor(_localNodeId);

            Assert.Single(Mock(channel1).Writes);
            Assert.Equal(1, Application.InformAttributeSetCreatedCheck.Get());
        }
Esempio n. 2
0
        public void TestInboundStreamInterestRemoveAttributeSet()
        {
            var inboundStreamInterest =
                TestWorld.ActorFor <IInboundStreamInterest>(
                    Definition.Has <AttributesAgentActor>(
                        Definition.Parameters(_localNode, Application, _outboundStream.Actor, Config, _interest)));

            var createMessage = CreateAttributeSet.From(_localNode, _set);

            inboundStreamInterest.Actor.HandleInboundStreamMessage(AddressType.Op, RawMessageFor(_localNodeId, _localNode.Name, createMessage));
            var removeMessage = RemoveAttributeSet.From(_localNode, _set);

            inboundStreamInterest.Actor.HandleInboundStreamMessage(AddressType.Op, RawMessageFor(_localNodeId, _localNode.Name, removeMessage));

            var channel1 = _channelProvider.ChannelFor(_localNodeId);

            Assert.Equal(2, Mock(channel1).Writes.Count);
            Assert.Equal(1, Application.InformAttributeSetCreatedCheck.Get());
            Assert.Equal(1, Application.InformAttributeSetRemovedCheck.Get());
        }