public void DataContextGetAllTest() { MyProductContext myProductContext = new MyProductContext(); myProductContext.Add(getMyProducts()); Assert.AreEqual(myProductContext.GetAll().Count, 504); }
public void GetTotalStandardCostByCategoryTest() { MyProductContext myProductContext = new MyProductContext(); myProductContext.Add(getMyProducts()); MyProductService myProductService = new MyProductService(myProductContext); ProductCategory categoryName = DataService.getCategoryFromString("Components"); decimal cost = myProductService.GetTotalStandardCostByCategory(categoryName); Assert.AreEqual(35930.3944m, cost); }
public void GetProductsByNameTest() { MyProductContext myProductContext = new MyProductContext(); myProductContext.Add(getMyProducts()); MyProductService myProductService = new MyProductService(myProductContext); List <MyProduct> p1 = myProductService.GetProductsByName("Blade"); List <MyProduct> p2 = myProductService.GetProductsByName("Flat Washer"); List <MyProduct> p3 = myProductService.GetProductsByName("2137"); Assert.AreEqual(1, p1.Count); Assert.AreEqual(9, p2.Count); Assert.AreEqual(0, p3.Count); }
public void GetNMyProductFromCategoryTest() { MyProductContext myProductContext = new MyProductContext(); myProductContext.Add(getMyProducts()); MyProductService myProductService = new MyProductService(myProductContext); List <MyProduct> list = myProductService.GetNMyProductFromCategory("Components", 4); Assert.AreEqual(list.Count, 4); for (int i = 0; i < list.Count; i++) { Assert.AreEqual(list[i].ProductSubcategory.ProductCategory.Name, "Components"); } }