Hi Team
I want to create unit test for user input, anyone who can help me please do share the information with me if you can, thanks mates or examples to do this as i never used them before for console app in user input for number less than 5 and its output for that number.
- // Program accept number less than 5 or more and make its output difference.
- using System;
- public class UserApp
- {
- public static void Main()
- {
- string[] seperators = {",", " ", ";", "."};
- int num2;
- Console.WriteLine("Input numbers over 10:");
- string[] splitArray = Console.ReadLine().Split(seperators, StringSplitOptions.RemoveEmptyEntries);
- foreach (string num in splitArray)
- {
- if(Int32.TryParse(num, out num2) == true)
- {
- if (num2 < 10)
- {
- Console.WriteLine(num + " is smaller than 10");
- }
- }
- else
- {
- Console.WriteLine(num + " is not a number...");
- }
- }
- }
- }
Siddharth GajbhiyePosted Feb 17, 2020, 11:04 PM
Guest UserPosted Feb 17, 2020, 10:58 PM
Bhawna TutejaPosted Feb 17, 2020, 10:22 PM