I have created a Hello World program and I am new to C#, My program will print 100 words like that as follow
public static void Main(/*I forgot arguments*/)
{
string []s=new string [100];
foreach(string ss in s)
{
ss="Hello World";
Console.WriteLine("{0}\n",ss);
}
}
Could you show me step-by-step how to create a test for this program ? Does it need one ? I don’t have an image of how testers do the test. Sorry I am stupid.
I think I have tried my best, no one ever find I find it unworthy to me not to get any help ? I don’t need the class because I forgot the class long ago after the accident.
First of all, you can’t (or – you shouldn’t) test
voidmethods. You are testing the output of the method – which Main does not have. Second thought: you cannot mock (simulate) anConsoleobject. Read some tutorials about mock and mocking.Sample method with sample test could look similar to this:
Hope this helped a little.