public void TestRepositoryAddProductWithCategory() { CategoryRepository categoryRepository = new CategoryRepository(); Category categoryTest = new Category("categoryTestid", "categoryTestDesc"); categoryRepository.AddEntity(categoryTest); productTest.Category = categoryTest; productRepository.AddEntity(productTest); Assert.IsNotNull(productRepository.GetProductById(productTest.ProductId).Category); }
public void TestRepositoryUpdateProductAddCategory() { CategoryRepository categoryRepository = new CategoryRepository(); Category categoryTest = new Category("categoryTestid", "categoryTestDesc"); categoryRepository.AddEntity(categoryTest); productRepository.AddEntity(productTest); productTest.Category = categoryTest; productRepository.UpdateEntity(productTest); Product obtainedProduct = productRepository.GetProductById(productTest.ProductId); Assert.IsNotNull(obtainedProduct.Category); }
public void TestRepositoryAddCategory() { categoryRepository.AddEntity(categoryTest); Assert.IsTrue(categoryTest.Equals(categoryRepository.GetCategoryById(categoryTest.CategoryId))); }