Example #1
0
        public void Get_All_In_Amount_Range_Should_Work_Correctly()
        {
            // Arrange
            var chainblock = new Models.Chainblock();

            var transaction0 = new Transaction(99, "Peshko", "Samuilcho", 10, TransactionStatus.Successfull);
            var transaction1 = new Transaction(100, "Peshko", "Samuilcho", 100, TransactionStatus.Successfull);
            var transaction2 = new Transaction(101, "Peshko", "Samuilcho", 200, TransactionStatus.Successfull);
            var transaction3 = new Transaction(102, "Peshko", "Samuilcho", 300, TransactionStatus.Successfull);
            var transaction4 = new Transaction(103, "Peshko", "Samuilcho", 400, TransactionStatus.Successfull);
            var transaction5 = new Transaction(104, "Peshko", "Samuilcho", 400, TransactionStatus.Successfull);

            // Act
            chainblock.Add(transaction0);
            chainblock.Add(transaction1);
            chainblock.Add(transaction2);
            chainblock.Add(transaction3);
            chainblock.Add(transaction4);
            chainblock.Add(transaction5);

            var lo = 100;
            var hi = 400;

            var transactions = chainblock
                               .GetAllInAmountRange(lo, hi)
                               .ToList();

            // Assert
            Assert.That(transactions[0].Id, Is.EqualTo(100));
            Assert.That(transactions[1].Id, Is.EqualTo(101));
            Assert.That(transactions[2].Id, Is.EqualTo(102));
            Assert.That(transactions[3].Id, Is.EqualTo(103));
            Assert.That(transactions[4].Id, Is.EqualTo(104));
        }
Example #2
0
        public void Get_All_In_Amount_Range_Should_Throw_An_Exception_If_Hi_Is_Under_Zero()
        {
            // Arrange
            var chainblock = new Models.Chainblock();

            // Assert
            Assert.Throws <InvalidOperationException>(
                () => chainblock.GetAllInAmountRange(1, -2), // Act
                "Hi is not under zero");
        }
Example #3
0
        public void Get_All_In_Amount_Range_Should_Return_Empty_Collection()
        {
            // Arrange
            var chainblock = new Models.Chainblock();

            var transaction = new Transaction(104, "Peshko", "Samuilcho", 4100, TransactionStatus.Successfull);

            // Act
            chainblock.Add(transaction);

            var lo = 100;
            var hi = 400;

            var transactions = chainblock
                               .GetAllInAmountRange(lo, hi)
                               .ToList();

            // Assert
            Assert.That(transactions.Count == 0);
        }