private void Button_add_Click(object sender, RoutedEventArgs e) { (bool, int)ratingInput = validator.CheckIntInput(textBox_rating_value.Text); if (!ratingInput.Item1) { MessageBox.Show("Rating must be an integer"); } else if (ratingInput.Item2 <= 0 || ratingInput.Item2 > 5) { MessageBox.Show("Rating must be between 1 and 5"); } else { CrudReview.Create(ratingInput.Item2, textBox_comment_value.Text, Reviewer, Product); Close(); } }
public void IntInputCheck(string input, bool expectedBool, int expectedInt) { (bool, int)result = validator.CheckIntInput(input); Assert.AreEqual(expectedBool, result.Item1); Assert.AreEqual(expectedInt, result.Item2); }