public void GetTransactionsForUser_ReturnsCorrectTransactions_True() { IBarcodeSystem barcodeSystem = Substitute.For <IBarcodeSystem>(); User user = Substitute.For <User>(userArgs); Product product = Substitute.For <Product>(productArgs); user.Balance = 1000m; const int amountOfPurchases = 5; for (int i = 0; i < amountOfPurchases; i++) { barcodeSystem.BuyProduct(user, product); } IEnumerable <Transaction> transactionsForUser = barcodeSystem.GetTransactionsForUser(user, amountOfPurchases); Assert.That(transactionsForUser, Is.All.Property("User").EqualTo(user)); }
public override void Execute() { string username = Command[0]; try { User user = barcodeSystem.GetUserByUsername(username); List <Transaction> transactionsForUser = new List <Transaction>(); transactionsForUser = barcodeSystem .GetTransactionsForUser(user, 10) .Where(t => !t.Undone) .ToList(); barcodeCli.DisplayUserInfo(user, transactionsForUser); } catch (UserNotFoundException) { barcodeCli.DisplayUserNotFound(username); } base.Execute(); }