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...");
- }
- }
- }
- }

Bhawna TutejaRank #2,418 · 584 reputationPosted Feb 17, 2020, 5:22 PM EST
Guest UserRank #877 · 2.5K reputationPosted Feb 17, 2020, 5:58 PM EST
Siddharth GajbhiyeRank #376 · 6.7K reputationPosted Feb 17, 2020, 6:04 PM EST