public void GetProductPriceByIdTest_GivesIdToListWhichDoesntContainSpecifiedId_Returns0() { ProductLibrary library = new ProductLibrary(); List <Product> products = new List <Product>(); var product = new Product { Id = 1 }; products.Add(product); var result = library.GetProductPriceById(2, products); Assert.AreEqual(result, 0); }
public void GetProductPriceByIdTest_GivesId_ReturnsProductPriceForSpecifiedId(int id, double p) { ProductLibrary library = new ProductLibrary(); List <Product> products = new List <Product>(); var product = new Product { Id = id, Price = p }; products.Add(product); var result = library.GetProductPriceById(id, products); Assert.AreEqual(result, product.Price); }