Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to test console application
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
How to test console application
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01349592
Message ID:
01349592
Views:
81
Hi everybody,

This is actually sort of an initial interview question. I have this program
using System;

namespace CreditSights
{
    /// <summary>
    /// The purpose of this program is to read in a file and search for all
    /// occurrences of the string passed in. 
    /// 
    /// e.g. SearchForText.exe autonomous resume.txt
    /// e.g. SearchForText.exe smart resume.txt
    /// </summary>
    class SearchForText
    {
        static void Main(string[] args)
        {
            string toFind = args[1];
            string file = args[2];

            string text = System.IO.File.OpenText(file).ReadToEnd();

            Console.WriteLine("Found it at: " + text.IndexOf(toFind));
        }
    }
}
And I need to figure out what is wrong with it. I created a new Console application but then I try to debug it I obviously get an error. So, my question is how to test it.

Also in terms of what is wrong here I guess no error checking is the first thing that is wrong. But what else is wrong?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform