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"); }
public void TestComputeVATForInvalidOutput() { Lab2.Product product = new Lab2.Product(1, "ceapa", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 15.5, 25); Assert.AreNotEqual(product.ComputeVAT(), 19, "This shouldn't be equal"); }
public void TestComputeVATGivenValidData() { Lab2.Product product = new Lab2.Product(1, "ceapa", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 15.5, 25); Assert.AreEqual(product.ComputeVAT(), 19.375, "This should be equal"); }
public void TestIsValidGivenEndDateBefortToday() { Lab2.Product product = new Lab2.Product(1, "ceapa", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2017, 12, 14), 20, 30); Assert.AreEqual(product.IsValid(), false, "This should be false"); }
public void TestIsValidGivenCorrectData() { Lab2.Product product = new Lab2.Product(1, "ceapa", "de mancat", new System.DateTime(2011, 12, 13), new System.DateTime(2019, 12, 14), 20, 30); Assert.AreEqual(product.IsValid(), true, "This should be true"); }