示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testExistingMasterWinsWhenComparedToLowerIdSameTxId()
        public virtual void TestExistingMasterWinsWhenComparedToLowerIdSameTxId()
        {
            DefaultElectionCredentials currentMaster = new DefaultElectionCredentials(2, 10, true);
            DefaultElectionCredentials incoming      = new DefaultElectionCredentials(1, 10, false);

            IList <ElectionCredentials> toSort = new List <ElectionCredentials>(2);

            toSort.Add(currentMaster);
            toSort.Add(incoming);
            toSort.Sort();

            assertEquals(toSort[0], incoming);
            assertEquals(toSort[1], currentMaster);
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testCompareToSameTxId()
        public virtual void TestCompareToSameTxId()
        {
            // Lower id means higher priority
            DefaultElectionCredentials highSameTxId = new DefaultElectionCredentials(1, 10, false);

            DefaultElectionCredentials lowSameTxId = new DefaultElectionCredentials(2, 10, false);

            IList <ElectionCredentials> toSort = new List <ElectionCredentials>(2);

            toSort.Add(highSameTxId);
            toSort.Add(lowSameTxId);
            toSort.Sort();
            assertEquals(toSort[0], lowSameTxId);
            assertEquals(toSort[1], highSameTxId);
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testCompareToDifferentTxId()
        public virtual void TestCompareToDifferentTxId()
        {
            DefaultElectionCredentials highTxId = new DefaultElectionCredentials(3, 12, false);

            DefaultElectionCredentials mediumTxId = new DefaultElectionCredentials(1, 11, false);

            DefaultElectionCredentials lowTxId = new DefaultElectionCredentials(2, 10, false);

            IList <ElectionCredentials> toSort = new List <ElectionCredentials>(2);

            toSort.Add(mediumTxId);
            toSort.Add(highTxId);
            toSort.Add(lowTxId);
            toSort.Sort();
            assertEquals(toSort[0], lowTxId);
            assertEquals(toSort[1], mediumTxId);
            assertEquals(toSort[2], highTxId);
        }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testEquals()
        public virtual void TestEquals()
        {
            DefaultElectionCredentials sameAsNext = new DefaultElectionCredentials(1, 10, false);

            DefaultElectionCredentials sameAsPrevious = new DefaultElectionCredentials(1, 10, false);

            assertEquals(sameAsNext, sameAsPrevious);
            assertEquals(sameAsNext, sameAsNext);

            DefaultElectionCredentials differentTxIdFromNext = new DefaultElectionCredentials(1, 11, false);

            DefaultElectionCredentials differentTxIdFromPrevious = new DefaultElectionCredentials(1, 10, false);

            assertNotEquals(differentTxIdFromNext, differentTxIdFromPrevious);
            assertNotEquals(differentTxIdFromPrevious, differentTxIdFromNext);

            DefaultElectionCredentials differentURIFromNext = new DefaultElectionCredentials(1, 11, false);

            DefaultElectionCredentials differentURIFromPrevious = new DefaultElectionCredentials(2, 11, false);

            assertNotEquals(differentTxIdFromNext, differentURIFromPrevious);
            assertNotEquals(differentTxIdFromPrevious, differentURIFromNext);
        }