Пример #1
0
        public void ShouldSortBasedOnBlockNumberAndTransaction()
        {
            //given
            var filterLog = new FilterLog()
            {
                BlockNumber = new HexBigInteger(1),
                TransactionIndex = new HexBigInteger(1)
            };
            var eventLog = new EventLog<MyEvent>(null, filterLog);
            var filterLog2 = new FilterLog()
            {
                BlockNumber = new HexBigInteger(2),
                TransactionIndex = new HexBigInteger(1)
            };
            var eventLog2 = new EventLog<MyEvent>(null, filterLog2);

            var filterLog3 = new FilterLog()
            {
                BlockNumber = new HexBigInteger(2),
                TransactionIndex = new HexBigInteger(2)
            };
            var eventLog3 = new EventLog<MyEvent>(null, filterLog3);

            var list = new List<object>(new[] {eventLog3, eventLog, eventLog2});
            list.Sort(new EventLogBlockNumberTransactionIndexComparer());
            Assert.Same(eventLog, list[0]);
            Assert.Same(eventLog2, list[1]);
            Assert.Same(eventLog3, list[2]);
        }
Пример #2
0
        public void ShouldSortBasedOnBlockNumberAndTransactionIndex()
        {
            //given
            var filterLog = new FilterLog() { BlockNumber = new HexBigInteger(1), TransactionIndex = new HexBigInteger(1) };
            var filterLog2 = new FilterLog() { BlockNumber = new HexBigInteger(2), TransactionIndex = new HexBigInteger(1) };
            var filterLog3 = new FilterLog() { BlockNumber = new HexBigInteger(2), TransactionIndex = new HexBigInteger(2) };

            var list = new List<FilterLog>(new[] { filterLog3, filterLog, filterLog2 });
            list.Sort(new FilterLogBlockNumberTransactionIndexComparer());
            Assert.Same(filterLog, list[0]);
            Assert.Same(filterLog2, list[1]);
            Assert.Same(filterLog3, list[2]);
        }