public void TestProductRepositoryConstructor() { Lab2.Product product = new Lab2.Product(1, "ceapa", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.Product product2 = new Lab2.Product(2, "strugure", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.Product product3 = new Lab2.Product(3, "albina", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.ProductRepository productRepository = new Lab2.ProductRepository(product, product2, product3); }
public void TestfindAllProducts() { Lab2.Product product = new Lab2.Product(1, "ceapa", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.Product product2 = new Lab2.Product(2, "strugure", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.Product product3 = new Lab2.Product(3, "albina", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.ProductRepository productRepository = new Lab2.ProductRepository(product, product2, product3); Assert.AreEqual(3, productRepository.findAllProducts().Count, "List of products incomplete"); }
public void TestGetProductByPosition() { Lab2.Product product = new Lab2.Product(1, "ceapa", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.Product product2 = new Lab2.Product(2, "strugure", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.Product product3 = new Lab2.Product(3, "albina", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.ProductRepository productRepository = new Lab2.ProductRepository(product, product2, product3); Assert.AreEqual(product, productRepository.GetProductbyPosition(1), "Wrong product returned"); }
public void TestRemoveProductByname() { Lab2.Product product = new Lab2.Product(1, "ceapa", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.Product product2 = new Lab2.Product(2, "strugure", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.Product product3 = new Lab2.Product(3, "albina", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.ProductRepository productRepository = new Lab2.ProductRepository(product, product2, product3); productRepository.RemoveProductByName("albina"); Assert.AreEqual(2, productRepository.findAllProducts().Count, "Product not removed"); }
public void TestAddProduct() { Lab2.Product product = new Lab2.Product(1, "ceapa", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.Product product2 = new Lab2.Product(2, "strugure", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.Product product3 = new Lab2.Product(3, "albina", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Lab2.ProductRepository productRepository = new Lab2.ProductRepository(product, product2, product3); Lab2.Product product4 = new Lab2.Product(4, "gelu", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); productRepository.AddProduct(product4); Assert.AreEqual(product4, productRepository.GetProductByName("gelu"), "Product not added"); }