public void Setup()
        {
            InnerTransport = new TestTransport(Self.EndPoint);

            var configuration = new Mock<IBusConfiguration>();
            configuration.Setup(x => x.IsPersistent).Returns(IsPersistent);
            configuration.Setup(x => x.StartReplayTimeout).Returns(TimeSpan.FromMinutes(60));

            PeerDirectory = new Mock<IPeerDirectory>();
            PeerDirectory.Setup(dir => dir.GetPeersHandlingMessage(It.IsAny<StartMessageReplayCommand>())).Returns(new[] { PersistencePeer });
            PeerDirectory.Setup(dir => dir.GetPeersHandlingMessage(It.IsAny<PersistMessageCommand>())).Returns(new[] { PersistencePeer });
            PeerDirectory.Setup(dir => dir.GetPeersHandlingMessage(It.IsAny<MessageHandled>())).Returns(new[] { PersistencePeer });
            PeerDirectory.Setup(dir => dir.IsPersistent(AnotherPersistentPeer.Id)).Returns(true);
            PeerDirectory.Setup(dir => dir.IsPersistent(AnotherNonPersistentPeer.Id)).Returns(false);

            Transport = new PersistentTransport(configuration.Object, InnerTransport, PeerDirectory.Object);
            Transport.Configure(Self.Id, "test");

            MessagesForwardedToBus = new ConcurrentQueue<TransportMessage>();
            Transport.MessageReceived += MessagesForwardedToBus.Enqueue;

            Transport.OnRegistered();
            var startMessageReplayMessage = InnerTransport.Messages.FirstOrDefault(x => x.TransportMessage.MessageTypeId == MessageUtil.TypeId<StartMessageReplayCommand>());
            if (startMessageReplayMessage != null)
            {
                StartMessageReplayCommand = (StartMessageReplayCommand)startMessageReplayMessage.TransportMessage.ToMessage();
                StartMessageReplayCommandTargets = startMessageReplayMessage.Targets;
            }

            InnerTransport.Messages.Clear();
        }
Example #2
0
 public ReplayPhase(PersistentTransport transport)
     : base(transport)
 {
 }
Example #3
0
 public NormalPhase(PersistentTransport transport)
     : base(transport)
 {
 }
Example #4
0
 public SafetyPhase(PersistentTransport transport)
     : base(transport)
 {
 }
Example #5
0
 protected Phase(PersistentTransport transport)
 {
     Transport = transport;
 }
 public ReplayPhase(PersistentTransport transport)
     : base(transport)
 {
 }
 public NormalPhase(PersistentTransport transport)
     : base(transport)
 {
 }
 public SafetyPhase(PersistentTransport transport) : base(transport)
 {
 }
 protected Phase(PersistentTransport transport)
 {
     Transport = transport;
 }