Inheritance: IMasterElections
        public void LostConnectionWithMasterTest()
        {
            byte lostServerId = MasterId;

            var elections = new MasterElections();
            elections.Init();

            m_ServerConfigurationMock.SetupGet(m => m.ServerId).Returns(ServerId);
            m_ServerConfigurationMock.SetupGet(m => m.IsSynced).Returns(true);

            var sibling1 = new Mock<INodeConfiguration>();
            sibling1.SetupGet(m => m.ServerId).Returns(2);
            sibling1.Setup(m => m.DeclareAsNewMaster()).Verifiable();

            var sibling2 = new Mock<INodeConfiguration>();
            sibling2.SetupGet(m => m.ServerId).Returns(3);

            m_NodesCollectionMock.SetupGet(m => m.All).Returns(new[] { sibling1.Object, sibling2.Object }.ToList().AsReadOnly());

            m_NodesCollectionMock.Setup(m => m.MarkAsDead(lostServerId)).Verifiable();

            m_ConnectionManagerMock.Raise(m => m.OnConnectionLoss += null, lostServerId);

            m_NodesCollectionMock.Verify(m => m.MarkAsDead(lostServerId));
            sibling1.Verify(m => m.DeclareAsNewMaster());
        }
        public void LostConnectionWithItselfTest()
        {
            var elections = new MasterElections();
            elections.Init();

            m_ServerConfigurationMock.SetupGet(m => m.ServerId).Returns(ServerId);
            m_ConnectionManagerMock.Raise(m => m.OnConnectionLoss += null, ServerId);
        }
        public void LostConnectionWithSlaveTest()
        {
            byte lostServerId = 121;

            var elections = new MasterElections();
            elections.Init();

            m_ServerConfigurationMock.SetupGet(m => m.ServerId).Returns(ServerId);
            m_ServerConfigurationMock.SetupGet(m => m.IsSynced).Returns(true);

            m_NodesCollectionMock.Setup(m => m.MarkAsDead(lostServerId)).Verifiable();

            m_ConnectionManagerMock.Raise(m => m.OnConnectionLoss += null, lostServerId);

            m_NodesCollectionMock.Verify(m => m.MarkAsDead(lostServerId));
        }