示例#1
0
 public void TestGetProductByName()
 {
     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.Id, productRepository.GetProductByName("ceapa").Id, "Wrong product returned");
 }
示例#2
0
 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");
 }