TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
2.1k
472.6k
How to create unit test cases for user input in C#?
Feb 16 2020 11:54 PM
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..."
);
}
}
}
}
Reply
Answers (
3
)
how to open pdf file in pdfview in asp.net ?
Check Wheather User Data Exists in Database without PageLoad