当前位置: 首页>>代码示例>>C#>>正文


C# Peer.ToPeerDescriptor方法代码示例

本文整理汇总了C#中Peer.ToPeerDescriptor方法的典型用法代码示例。如果您正苦于以下问题:C# Peer.ToPeerDescriptor方法的具体用法?C# Peer.ToPeerDescriptor怎么用?C# Peer.ToPeerDescriptor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Peer的用法示例。


在下文中一共展示了Peer.ToPeerDescriptor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

        public void Setup()
        {
            _configurationMock = new Mock<IDirectoryConfiguration>();
            _bus = new TestBus();

            var peer = new Peer(new PeerId("Abc.Testing.0"), "tcp://abctest:12300");
            var peerDescriptor = peer.ToPeerDescriptor(true);
            _entry = new DeadPeerDetectorEntry(peerDescriptor, _configurationMock.Object, _bus, new CurrentThreadTaskScheduler());
        }
开发者ID:rbouallou,项目名称:Zebus.Directory,代码行数:9,代码来源:DeadPeerDetectorEntryTests.cs

示例2: should_re_register_peer

        public void should_re_register_peer()
        {
            var peers = new List<PeerDescriptor>();
            _bus.AddHandler<RegisterPeerCommand>(x => new RegisterPeerResponse(peers.ToArray()));

            var peer1 = new Peer(new PeerId("Abc.X.1"), "tcp://x:1");
            peers.Add(peer1.ToPeerDescriptor(true, typeof(FakeCommand)));

            _directory.Register(_bus, _self, new Subscription[0]);
            _directory.GetPeersHandlingMessage(new FakeCommand(0)).ExpectedSingle().Id.ShouldEqual(peer1.Id);

            peers.Clear();
            var peer2 = new Peer(new PeerId("Abc.X.2"), "tcp://x:2");
            peers.Add(peer2.ToPeerDescriptor(true, typeof(FakeCommand)));

            _directory.Register(_bus, _self, new Subscription[0]);
            _directory.GetPeersHandlingMessage(new FakeCommand(0)).ExpectedSingle().Id.ShouldEqual(peer2.Id);
        }
开发者ID:MarouenK,项目名称:Zebus,代码行数:18,代码来源:PeerDirectoryClientTests.cs

示例3: should_have_unique_peer_instance_for_all_messages

        public void should_have_unique_peer_instance_for_all_messages()
        {
            _directory.Handle(new PeerStarted(_otherPeer.ToPeerDescriptor(true, typeof(FakeEvent))));
            _directory.Handle(new PeerStopped(_otherPeer));

            var otherPeerWithNewEndPoint1 = new Peer(_otherPeer.Id, "tcp://wtf:1");
            _directory.Handle(new PeerStarted(otherPeerWithNewEndPoint1.ToPeerDescriptor(true, typeof(FakeEvent), typeof(OtherFakeEvent1))));
            _directory.Handle(new PeerStopped(otherPeerWithNewEndPoint1));

            var otherPeerWithNewEndPoint2 = new Peer(_otherPeer.Id, "tcp://wtf:2");
            _directory.Handle(new PeerStarted(otherPeerWithNewEndPoint2.ToPeerDescriptor(true, typeof(FakeEvent), typeof(OtherFakeEvent1), typeof(OtherFakeEvent2))));

            var peer1 = _directory.GetPeersHandlingMessage(new FakeEvent(0)).ExpectedSingle();
            var peer2 = _directory.GetPeersHandlingMessage(new OtherFakeEvent1()).ExpectedSingle();
            var peer3 = _directory.GetPeersHandlingMessage(new OtherFakeEvent2()).ExpectedSingle();

            peer1.EndPoint.ShouldEqual(peer2.EndPoint);
            peer1.EndPoint.ShouldEqual(peer3.EndPoint);
        }
开发者ID:MarouenK,项目名称:Zebus,代码行数:19,代码来源:PeerDirectoryClientTests.cs

示例4: should_not_impact_other_peers_when_decommissioning_a_peer

        public void should_not_impact_other_peers_when_decommissioning_a_peer()
        {
            var anotherPeer = new Peer(new PeerId("Abc.Testing.2"), "tcp://abctest:987");
            _directory.Handle(new PeerStarted(_otherPeer.ToPeerDescriptor(true, typeof(FakeEvent))));
            _directory.Handle(new PeerStarted(anotherPeer.ToPeerDescriptor(true, typeof(FakeEvent))));
            
            _directory.Handle(new PeerDecommissioned(anotherPeer.Id));

            var peers = _directory.GetPeersHandlingMessage(new FakeEvent(0));
            peers.Count.ShouldEqual(1);
        }
开发者ID:MarouenK,项目名称:Zebus,代码行数:11,代码来源:PeerDirectoryClientTests.cs

示例5: should_support_multiple_peers_for_same_message

        public void should_support_multiple_peers_for_same_message()
        {
            var otherPeer2 = new Peer(new PeerId("Abc.Testing.2"), "tcp://abctest:987");

            _directory.Handle(new PeerStarted(_otherPeer.ToPeerDescriptor(true, typeof(FakeEvent))));
            _directory.Handle(new PeerStarted(otherPeer2.ToPeerDescriptor(true, typeof(FakeEvent))));

            var peers = _directory.GetPeersHandlingMessage(new FakeEvent(0));
            peers.Count.ShouldEqual(2);
        }
开发者ID:MarouenK,项目名称:Zebus,代码行数:10,代码来源:PeerDirectoryClientTests.cs

示例6: should_update_peers

        public void should_update_peers()
        {
            _directory.Handle(new PeerStarted(_otherPeer.ToPeerDescriptor(true, typeof(FakeEvent), typeof(OtherFakeEvent1))));
            _directory.Handle(new PeerStopped(_otherPeer));

            const string newEndPoint = "tcp://new-end-point:111";
            var newPeer = new Peer(_otherPeer.Id, newEndPoint);
            _directory.Handle(new PeerStarted(newPeer.ToPeerDescriptor(true, typeof(FakeCommand), typeof(OtherFakeEvent1))));

            _directory.GetPeersHandlingMessage(new FakeEvent(0)).ShouldBeEmpty();
            var peer = _directory.GetPeersHandlingMessage(new FakeCommand(0)).Single();
            peer.Id.ShouldEqual(_otherPeer.Id);
            peer.EndPoint.ShouldEqual(newEndPoint);

            var peer2 = _directory.GetPeersHandlingMessage(new OtherFakeEvent1()).Single();
            peer2.Id.ShouldEqual(_otherPeer.Id);
            peer2.EndPoint.ShouldEqual(newEndPoint);
        }
开发者ID:MarouenK,项目名称:Zebus,代码行数:18,代码来源:PeerDirectoryClientTests.cs


注:本文中的Peer.ToPeerDescriptor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。