public void TestGetProducts(int i, string expected) { TestProducts myTestRepo = new TestProducts(); List <Product> result = myTestRepo.GetProducts(); string productName = result[i].ProductType; Assert.AreEqual(expected, productName); }
public Product Get(string name, Action <ProductAssembler> product) { _currentProductId++; var productObj = TestProducts.Product(_currentProductId, name); var productAssembler = new ProductAssembler(); product(productAssembler); _mocks.PriceService.GetPrice(productObj.Info.Id).Returns(productAssembler.Price); return(productObj); }
public ProductsTable AddOrUpdate(string name, Action <ProductAssembler> product) { _currentProductId++; var productObj = TestProducts.Product(_currentProductId, name); var productAssembler = new ProductAssembler(); product(productAssembler); if (_products.ContainsKey(name)) { _products.Remove(name); } _products.Add(name, productObj); _mocks.PriceService.GetPrice(productObj.Info.Id).Returns(productAssembler.Price); return(this); }
static void Main(string[] args) { //TESTING...PRODUCTS //TestProducts.TestGetProductDetails1(); //TestProducts.TestGetProductDetails2(); //TestProducts.TestAddUpdateProduct1(); TestProducts.TestDumpAllProductDetailsLong(); TestProducts.TestDumpAllProductDetailsShort(); //???????????? //TestProducts.TestProductHierarchy(); //print display (not nested...) //TestProducts.TestProductHierarchy2(); //???(broken)??? trying to display (all properties and nested) dynamically //???????????? //TESTING...INVENTORY //TestInventory.TestSearchInventory1(); //TestInventory.TestSearchInventory2(); //TestInventory.TestAddUpdateInventory1(); //TestInventory.TestAddUpdateInventory2(); //TestInventory.TestAddUpdateInventory3(); //****************************************************************************** //****************************************************************************** //USERNAME AND PASSWORD (VIN65 API) //string WS_USERNAME = "******"; //string WS_PASSWORD = "******"; //Program prgm = new Program(); //prgm.abc(); //ProductController pc = new ProductController(WS_USERNAME, WS_PASSWORD); //product.PS_SearchProductBySKU("739242"); //Console.WriteLine("******"); //Console.WriteLine(product.PS_Response.Products[0].ProductID); ////------------------- ////SEARCH ALL PRODUCTS //List<PS_Product1> products = new List<PS_Product1>(); ////PS_Product1[] products = new PS_Product1[](); //products = pc.PS_SearchAllProducts(); //Console.WriteLine("******"); //Console.WriteLine("Count: " + products.Count); //Console.WriteLine("id: " + products[0].ProductID); //Console.WriteLine("id: " + products[1].ProductID); //Console.WriteLine("id: " + products[2].ProductID); //Console.WriteLine("id: " + products[3].ProductID); //Console.WriteLine("******"); ////PRINT (all products) //Console.WriteLine(prgm.AllProductsToString(products)); ////------------------- ////SEARCH FOR (ONE PRODUCT) //Console.WriteLine("--------------"); //PS_Product1 product = new PS_Product1(); //product = pc.PS_SearchProductBySKU("739242"); //Console.WriteLine(prgm.OneProductToString(product)); ////product to file... ////pc.PS_ProductToXmlFile(product); ////PRINT XML TO CONSOLE... //ProductController pc2 = new ProductController(WS_USERNAME, WS_PASSWORD); //Console.WriteLine("--------------"); //Console.WriteLine("--------------"); //Console.WriteLine(XmlController.Serialize(pc2.PS_SearchAllProducts2())); ////WRITE TO FILE //string xmlPath = @"c:\_temp"; //string xmlString = XmlController.Serialize(pc2.PS_SearchAllProducts2()); //XmlController.WriteXMLToFile(xmlString, xmlPath); Console.Read(); //keep console window open }