public void ExecuteTest() { var user = new User("test", "test", "test", "*****@*****.**", 99); var product1 = new BuyTransaction(DateTime.Now, user, new Product("test", 100, true)); var product2 = new BuyTransaction(DateTime.Now, user, new Product("test", 0, false)); Assert.Throws<InsufficientCreditsException>(new TestDelegate(() => { product1.Execute(); })); Assert.Throws<NotActiveException>(new TestDelegate(() => { product2.Execute(); })); }
public void DisplayUserBuysProduct(BuyTransaction transaction, int count) { Console.WriteLine("[{0}] bought {1} [{2}].", transaction.User.UserName, count, transaction.Product.Name); }
public void DisplayUserBuysProduct(BuyTransaction transaction) { Console.WriteLine("[{0}] bought [{1}].", transaction.User.UserName, transaction.Product.Name); }