Пример #1
0
        public void Can_Restore_State_From_Memento_And_Assign_New_CorrelationId()
        {
            var memento    = DiscoveryHelper.MockMemento();
            var originator = new HastingsOriginator(memento);

            originator.RestoreMemento(memento);

            originator.Peer.Should().Be(memento.Peer);
            originator.Neighbours.Should().BeEquivalentTo(memento.Neighbours);

            originator.PnrCorrelationId.Should().NotBe(default);
Пример #2
0
        public DiscoveryTestBuilder WithCurrentStep(IHastingsMemento currentStep = default,
                                                    bool mock              = false,
                                                    PeerId peer            = default,
                                                    INeighbours neighbours = default)
        {
            if (_careTaker == null)
            {
                WithCareTaker();
            }

            var memento = mock
                ? currentStep ?? DiscoveryHelper.MockMemento(peer, neighbours)
                : currentStep ?? DiscoveryHelper.SubMemento(peer, neighbours);

            _careTaker.Add(memento);

            return(this);
        }