public void editProductTestNormalCase()
 {
     ProductController productcontroller = new ProductController();
     Product p = new Product();
     p.Name = "test";
     p.Barcode = "1";
     p.Price = 1.1f;
     Response response = productcontroller.updateProduct(p,
         new Input("name", "test"),
         new Input("barcode", "1"),
         new Input("price", "1,1"));
      Assert.AreEqual(response.State, ResponseState.SUCCESS);
 }
 public void editProductTestEmptybarcode()
 {
     ProductController productcontroller = new ProductController();
     Product p = new Product();
     p.Name = "test";
     p.Barcode = "";
     p.Price = 1.1f;
     Response response = productcontroller.updateProduct(p,
         new Input("name", ""),
        new Input("price", "1.0"),
        new Input("barcode", "")
        );
     Assert.AreEqual(response.State, ResponseState.FAIL);
     Assert.Greater(response.Errors.Count(error => error.ErrorMessage == "Please add the product barcode"), 0);
 }
        public AddProduct()
        {
            InitializeComponent();
            _market = Market.getInstance();
            _productController = new ProductController();

            #region Bardetecting Example
            //OnBarcodeDetectedDelegate testD = testDelegateFunction; //Testing variable for OnBarcodeDetectedDelegate
            BarcodeReading.BarcodeReader bcr = new BarcodeReading.BarcodeReader(ref textBoxBarcode, ref player); //Testing variable for BarcodeReader class ( see constructor documentation )
            //bcr.onBarcodeDetected += testD; //Adding the delegate function to onBarcodeDetected variable at bcr to fire it after detecting barcode emplicitily
            //If camera opened successfully read barcode and fire onBarcodeDetected delegate
            //if (bcr.openCamera() == true)
            bcr.readBarcodes();
            #endregion
            
            LoadComboxList();
        }
        public void createProductTestNormalCase()
        {
            ProductController productController = new ProductController();
            Response response = productController.createProduct(
                new Input("name", "1"),
                new Input("barcode", "1"),
                new Input("price", "1"),
                new Input("categoryId", "1"),
                new Input("weight", "1"),
                new Input("description", "1")
                );
            Assert.AreEqual(response.State, ResponseState.SUCCESS);

        }
 public void deleteProductTestNormalCase()
 {
     ProductController productcontroller = new ProductController();
     Product p = new Product();
     p.Name = "test";
     p.Barcode = "1";
     p.Price = 1.1f;
     Response response = productcontroller.deleteProduct(p);
     Assert.AreEqual(response.State, ResponseState.SUCCESS);
 }
        public void createProductTestNoDescription()
        {
            ProductController productController = new ProductController();
            Response response = productController.createProduct(
                new Input("name", "1"),
                new Input("barcode", "1"),
                new Input("price", "1"),
                new Input("categoryId", "1"),
                new Input("weight", "1"),
                new Input("description", "")
                );
            Assert.AreEqual(response.State, ResponseState.FAIL);
            Assert.Greater(response.Errors.Count(error => error.ErrorMessage == "Product Description can't be empty."), 0);

        }