public void Get_By_Sender_Ordered_By_Amount_Descending(string sender) { // Arrange var chainblock = new Models.Chainblock(); // Act var transaction1 = new Transaction(100, "Ivan", "Samuilcho", 100, TransactionStatus.Successfull); var transaction2 = new Transaction(101, "Ivan", "Samuilcho", 200, TransactionStatus.Successfull); var transaction3 = new Transaction(102, "Ivan", "Samuilcho", 300, TransactionStatus.Successfull); var transaction4 = new Transaction(103, "Ivan", "Samuilcho", 400, TransactionStatus.Successfull); chainblock.Add(transaction1); chainblock.Add(transaction2); chainblock.Add(transaction3); chainblock.Add(transaction4); var result = chainblock .GetBySenderOrderedByAmountDescending(sender) .ToList(); // Assert Assert.That(result[0].Id, Is.EqualTo(103)); Assert.That(result[1].Id, Is.EqualTo(102)); Assert.That(result[2].Id, Is.EqualTo(101)); Assert.That(result[3].Id, Is.EqualTo(100)); }
public void Get_By_Sender_Ordered_By_Amount_Descending_Should_Throw_An_Exception_If_Collection_Is_Empty() { // Arrange var chainblock = new Models.Chainblock(); // Act chainblock.Add(this.firstTransaction); string sender = "6i6ko"; // Assert Assert.Throws <InvalidOperationException>( () => chainblock.GetBySenderOrderedByAmountDescending(sender)); }