public void AddAndTestData() { //Connect to the test database Client client = new Client("JpczLFGlL0", "JpczLFGlL0", "TjTWsNqWOZ"); //Get all the existing products List <Product> products = client.GetProducts(); //Delete all the products client.DeleteProducts(products); //Check we deleted all the products products = client.GetProducts(); Assert.IsTrue(products.Count == 0); //Insert test data client.InsertTestData(); //Check they were correctly inserted products = client.GetProducts(); Assert.IsTrue(products.Count == 2); //addNewProduct client.addNewProduct("Pera", 0, 1); //Check correctly created products = client.GetProducts(); Assert.IsTrue(products.Count == 3); products = client.getSoldOut(); Assert.IsTrue(products.Count == 1); }
public void SetPriceTest() { //Connect to the test database Client client = new Client("NW0HSO5HO7", "NW0HSO5HO7", "ZEALzol3dN"); //Connect to BD /*m_connection = new MySqlConnection(); * m_connection.ConnectionString = * "Server=myremotesql.com ;" + * "database= NW0HSO5HO7;" + * "UID=NW0HSO5HO7; " + * "password=ZEALzol3dN;"; * m_connection.Open() = true; */ //Get product from BD client.buyProduct(5, 220, 3, 5); //Set price client.modificarPrecio(3.58, 23); //Check if were correctly modify // Get product from BD client.GetProducts(); //Delete test product //Assume producto and producto_pedido are correctly related and product reference in producto_pedido will be deleted on cascade int[] aids = { 23 }; client.DeleteProducts(aids); }
public void InsertProductTest() { //Connect to the test database Client client = new Client("NW0HSO5HO7", "NW0HSO5HO7", "ZEALzol3dN"); //Get all the existing products List <Producto> products = client.GetProducts(); //Delete all the products client.DeleteProducts(products); //Insert a product client.insertProduct(24, "Manzana", 3); //Connect to BD //Get product from BD client.GetProducts(); }
public void TestWriteDownProducts() { // Connect to the test database Client client = new Client("pBRMsmc7h2", "pBRMsmc7h2", "mQvsG2x5NR"); //Get all the existing products List <Product> productosPedidos = client.GetProducts(); client.DeleteProducts(productosPedidos); //Check we deleted all the products productosPedidos = client.GetProducts(); Assert.IsTrue(productosPedidos.Count == 0); //Insert test data client.InsertTestData(); //Check they were correctly inserted productosPedidos = client.GetProducts(); Assert.IsTrue(productosPedidos.Count == 2); }
public void AddAndTestData() { //Connect to the test database Client client = new Client("NLphb4HrH0", "NLphb4HrH0", "VM8GYV3qZ7"); //Get all the existing products List <Product> products = client.GetProducts(); //Delete all the products client.DeleteProducts(products); //Check we deleted all the products products = client.GetProducts(); Assert.IsTrue(products.Count == 0); //Insert test data client.InsertTestData(); //Check they were correctly inserted products = client.GetProducts(); Assert.IsTrue(products.Count == 2); }
public void TestAddProduct() { // Connect to the test database Client client = new Client("pBRMsmc7h2", "pBRMsmc7h2", "mQvsG2x5NR"); //Get all the existing products List <Product> productsDB = client.GetProducts(); client.DeleteProducts(productsDB); //Check we deleted all the products productsDB = client.GetProducts(); Assert.IsTrue(productsDB.Count == 0); //crear un producto Product prod = new Product(3, "Pan", 3); client.AddProduct(prod); //Check they were correctly inserted productsDB = client.GetProducts(); Assert.IsTrue(productsDB.Count == 1); }