public void InputIntValidationDoubleIsFalse_Test()
        {
            bool   expected = false;
            string input    = "1,5";

            InputIntValidation inputIntValidation = new InputIntValidation();


            bool actual = inputIntValidation.InputNumber(input);

            Assert.Equal(expected, actual);
        }
        public void InputIntValidationIsTrue_Test()
        {
            //Arrange
            bool   expected = true;
            string input    = "5";

            InputIntValidation inputIntValidation = new InputIntValidation();
            //Act
            bool actual = inputIntValidation.InputNumber(input);

            //Assert
            Assert.Equal(expected, actual);
        }
        public void InputMinusIntValidationIsFalse_Test()
        {
            bool   expected = true;
            string input    = "-4";

            InputIntValidation inputIntValidation = new InputIntValidation();


            bool actual = inputIntValidation.InputNumber(input);


            Assert.Equal(expected, actual);

            // its TRUE cuz its number (found "bug" and its smashed)
        }
示例#4
0
        //Overloaded AskingForMultiplier() For Testing
        public void AskingForMultiplier(string dataIn)
        {
            InputIntValidation InputValid = new InputIntValidation();


            string input;

            input = dataIn;

            bool valid = InputValid.InputNumber(input);

            if (valid == true)
            {
                int rollTimeNumber;
                rollTimeNumber = Int32.Parse(input);
                MultipleMakingFullItem(rollTimeNumber);
            }
            else if (valid == false)
            {
                Console.WriteLine("Error, this is NOT a number (cw)");
                throw new Exception("Error, this is NOT a number");
            }
        }
示例#5
0
        public void AskingForMultiplier()
        {
            Console.WriteLine("\r\n Enter how many items should be rolled");
            InputIntValidation InputValid = new InputIntValidation();

            string input = Console.ReadLine();

            bool valid = InputValid.InputNumber(input);

            if (valid == true)
            {
                int rollTimeNumber;
                rollTimeNumber = Int32.Parse(input);

                if (rollTimeNumber > 0)
                {
                    MultipleMakingFullItem(rollTimeNumber);
                }
                else if (rollTimeNumber == 0)
                {
                    Console.WriteLine("Error, you CANT multiply by 0 (cw)");
                    AskingForMultiplier();
                }
                else
                {
                    Console.WriteLine("Error, you CANT multiply by negative number (cw)");
                    valid = false;
                    AskingForMultiplier();
                }
            }
            else if (valid == false)
            {
                Console.WriteLine("Error, this is NOT a number (cw)");

                AskingForMultiplier();
            }
        }