private void button_add_Click(object sender, RoutedEventArgs e) { (bool, decimal)priceInput = validator.CheckDecimalInput(textBox_price_value.Text); if (!priceInput.Item1) { MessageBox.Show("Price must be a numeric value"); return; } if (CrudProduct.ExistsByName(textBox_name_value.Text)) { MessageBox.Show($"Product: {textBox_name_value.Text} already exists"); return; } CrudProduct.Create(textBox_name_value.Text, priceInput.Item2, textBox_URL_value.Text); MessageBox.Show($"Product: {textBox_name_value.Text} created"); }
public void DecimalInputCheck(string input, bool expectedBool, decimal expectedDecimal) { (bool, decimal)result = validator.CheckDecimalInput(input); Assert.AreEqual(expectedBool, result.Item1); Assert.AreEqual(expectedDecimal, result.Item2); }