public void Clear() { ProductTypeRepository repo = CreateRepository(); repo.Clear(); Assert.AreEqual(0, repo.CountProducts()); }
public void SaveAndCount() { ProductTypeRepository repo = CreateRepository(); repo.Clear(); ProductType dryer = repo.CreateProduct(1, 263.00, "Very stronk pink hair dryer!!", 50); Assert.AreEqual(1, repo.CountProducts()); }
public void SaveAndCountTwoProducts() { ProductTypeRepository repo = CreateRepository(); repo.Clear(); ProductType dryer = repo.CreateProduct(1, 263.00, "Very stronk pink hair dryer!!", 50); ProductType hairbrush = repo.CreateProduct(2, 39.00, "Very soft purple hair brush", 20); Assert.AreEqual(2, repo.CountProducts()); }
public void SaveAndLoad() { ProductTypeRepository repo = CreateRepository(); repo.Clear(); ProductType dryer = repo.CreateProduct(1, 263.00, "Very stronk pink hair dryer!!", 50); ProductType loadedProduct = repo.Load(dryer.Id); Assert.AreEqual(dryer.Id, loadedProduct.Id); }
public void ChangeProductPrice() { ProductTypeRepository repo = CreateRepository(); repo.Clear(); ProductType dryer = repo.CreateProduct(1, 263.00, "Very stronk pink hair dryer!!", 50); repo.ChangePrice(20, 1); Assert.AreEqual(20, dryer.Price); }
public void ChangeProductAmount() { ProductTypeRepository repo = CreateRepository(); repo.Clear(); ProductType dryer = repo.CreateProduct(1, 263.00, "Very stronk pink hair dryer!!", 50); repo.ChangeAmount(49, 1); Assert.AreEqual(49, dryer.Amount); }
public void Create() { ProductTypeRepository repo = CreateRepository(); repo.Clear(); ProductType dryer = repo.CreateProduct(1, 263.00, "Very stronk pink hair dryer!!", 50); Assert.AreEqual(1, dryer.Id); Assert.AreEqual(263.00, dryer.Price); Assert.AreEqual("Very stronk pink hair dryer!!", dryer.Description); Assert.AreEqual(50, dryer.Amount); Assert.IsTrue(dryer.Id != 0); }
public void SaveAndLoadTwoProducts() { ProductTypeRepository repo = CreateRepository(); repo.Clear(); ProductType dryer = repo.CreateProduct(1, 263.00, "Very stronk pink hair dryer!!", 50); ProductType hairbrush = repo.CreateProduct(2, 39.00, "Very soft purple hair brush", 20); ProductType loadedDryer = repo.Load(dryer.Id); ProductType loadedBrush = repo.Load(hairbrush.Id); Assert.AreEqual(dryer.Id, loadedDryer.Id); Assert.AreEqual(hairbrush.Id, loadedBrush.Id); Assert.AreNotEqual(loadedDryer.Id, loadedBrush.Id); }
public void InitializeProductTypeRepository() { repoPr.Clear(); SqlCommand cmd = new SqlCommand("SP_GET_ALL_PRODUCTS", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { while (rdr.Read()) { repoPr.CreateProduct(Convert.ToInt32(rdr["PRODUCT_ID"]), Convert.ToDouble(rdr["PRICE"]), rdr["DESCRIPTION"].ToString(), Convert.ToInt32(rdr["AMOUNT"])); } } rdr.Close(); }