Get_All_Ordered_By_Amount_Descending_Then_By_Id_Should_Throw_An_Exception_If_There_Is_No_Transactions() { // Arrange var chainblock = new Models.Chainblock(); // Assert Assert.Throws <InvalidOperationException>( () => chainblock.GetAllOrderedByAmountDescendingThenById()); }
public void Get_All_Ordered_By_Amount_Descending_Then_By_Id() { // Arrange var chainblock = new Models.Chainblock(); // Act chainblock.Add(this.firstTransaction); this.secondTransaction = new Transaction(113, "Ivancho", "Samuilcho", 501, TransactionStatus.Successfull); chainblock.Add(this.secondTransaction); var thirdTransaction = new Transaction(111, "Ivo", "Ivcho", 501, TransactionStatus.Successfull); chainblock.Add(thirdTransaction); var transaction = chainblock .GetAllOrderedByAmountDescendingThenById() .ToList(); // Assert Assert.That(transaction[0].Id, Is.EqualTo(113)); Assert.That(transaction[1].Id, Is.EqualTo(111)); Assert.That(transaction[2].Id, Is.EqualTo(10)); Assert.That(transaction[0].From, Is.EqualTo("Ivancho")); Assert.That(transaction[1].From, Is.EqualTo("Ivo")); Assert.That(transaction[2].From, Is.EqualTo("Ivan")); Assert.That(transaction[0].To, Is.EqualTo("Samuilcho")); Assert.That(transaction[1].To, Is.EqualTo("Ivcho")); Assert.That(transaction[2].To, Is.EqualTo("Samuil")); Assert.That(transaction[0].Amount, Is.EqualTo(501)); Assert.That(transaction[1].Amount, Is.EqualTo(501)); Assert.That(transaction[2].Amount, Is.EqualTo(50)); Assert.That(transaction[0].Status, Is.EqualTo(TransactionStatus.Successfull)); Assert.That(transaction[1].Status, Is.EqualTo(TransactionStatus.Successfull)); Assert.That(transaction[2].Status, Is.EqualTo(TransactionStatus.Successfull)); }