/// <summary> /// Test of the ExistsPendriveTest function /// </summary> static public void ExistsPendriveTest() { StoreBL storeBL = new StoreBL(); Store store = new Store(); store.Name = "PenStore1"; store.ID = "1"; PenDrive pendrive1 = new PenDrive(); pendrive1.Brand = "brand1"; pendrive1.Model = "model1"; PenDrive pendrive2 = new PenDrive(); PenDrive pendrive3 = new PenDrive(); storeBL.AddPenDrive(store, pendrive1); storeBL.AddPenDrive(store, pendrive2); storeBL.AddPenDrive(store, pendrive3); if (storeBL.ExistPenDrive(store, "brand1", "model")) { Console.WriteLine("The pen exist"); } else { Console.WriteLine("The pen doesn't exist"); } }
/// <summary> /// Test of the CalculateTotalPriceTest function. /// </summary> static public void CalculateTotalPriceTest() { StoreBL storeBL = new StoreBL(); Store store = new Store(); decimal?sum = 0; store.Name = "PenStore1"; store.ID = "1"; PenDrive pendrive1 = new PenDrive(); pendrive1.Brand = "brand1"; pendrive1.Model = "model1"; pendrive1.Price = 34; PenDrive pendrive2 = new PenDrive(); pendrive2.Brand = "Brand2"; pendrive2.Price = 26; PenDrive pendrive3 = new PenDrive(); pendrive3.Brand = "Brand3"; pendrive3.Price = 40; PenDrive pendrive4 = new PenDrive(); pendrive4.Brand = "Brand4"; pendrive4.Price = 76; storeBL.AddPenDrive(store, pendrive1); storeBL.AddPenDrive(store, pendrive2); storeBL.AddPenDrive(store, pendrive3); storeBL.AddPenDrive(store, pendrive4); if (storeBL.CalculateTotalPrice(store, store.Products.Pendrives, out sum)) { Console.WriteLine("Successfully Calculated."); } else { Console.WriteLine("Not so successfully calculated."); } Console.WriteLine("Suma:" + sum.ToString()); }
/// <summary> /// Test of the AddPenDrive function /// </summary> static public void AddPendriveTest() { StoreBL storeBL = new StoreBL(); Store store = new Store(); store.Name = "PenStore1"; store.ID = "1"; PenDrive pendrive1 = new PenDrive(); if (storeBL.AddPenDrive(store, pendrive1)) { Console.WriteLine("Pendrive added."); } else { Console.WriteLine("There was a problem adding the pendrive."); } storeBL.AddPenDrive(store, pendrive1); }