Ejemplo n.º 1
0
        private void CheckValidInput()
        {
            var text = InputTextBox.Text;

            if (string.IsNullOrEmpty(text))
            {
                ErrorTextBlock.Visibility = Visibility.Hidden;
                EnableButton.IsEnabled    = false;
            }



            bool validInput = _reversalTool != null && _reversalTool.CheckValidInput(text);

            if (validInput)
            {
                ErrorTextBlock.Visibility = Visibility.Hidden;
                EnableButton.IsEnabled    = true;
            }
            else
            {
                ErrorTextBlock.Visibility = Visibility.Visible;
                ErrorTextBlock.Text       = "Invalid Input";
                EnableButton.IsEnabled    = false;
            }
        }
Ejemplo n.º 2
0
        public void CheckValidInput_Test(string input, bool isValid)
        {
            //Arrange
            ReversalTool reversalTool = new ReversalTool();

            //Act
            var result = reversalTool.CheckValidInput(input);

            //Assert

            Assert.AreEqual(isValid, result);
        }