public BuyTransaction BuyProduct(User user, Product product) { if (user != null && product != null) return new BuyTransaction(DateTime.Now, user, product); else return null; }
public BuyTransaction(DateTime date, User user, Product product) : base(date, user, product.Price) { Product = product; }
public void TwoProductsWithSameID() { var product = new Product("thing", 11, true, 100032); Assert.Throws<ArgumentException>(new TestDelegate(() => { var product2 = new Product("thing", 11, true, 100032); })); }
public void NameTest() { Assert.Throws<ArgumentNullException>(new TestDelegate(() => { var product = new Product(null, 11, true); })); }
public void DisplayInsufficientCash(User user, Product product, int count) { Console.WriteLine("Couldn't buy {0} [{1}]. Balance: [{2}] Price: [{3}].", count, product.Name, user.Balance.ToKr(), (product.Price * count).ToKr()); }
public void DisplayInsufficientCash(User user, Product product) { Console.WriteLine("Couldn't buy [{0}]. Balance: [{1}] Price: [{2}].", product.Name, user.Balance.ToKr(), product.Price.ToKr()); }
public InsufficientCreditsException(User user, Product product) : base(user.ToString() + " tried to buy " + product.ToString() + " but had insufficient credits") { User = user; Product = product; }