Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to test console application
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
How to test console application
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01349592
Message ID:
01349592
Vues:
82
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform