dinger2121
Programmer
Hello,
I am building a small application that is going to be used to move a file from one folder to another in a filesystem. I know that I can accomplish by using something similar to the following -
However, I have been really trying to move more toward tdd. With that being said, what should I be testing in a simple app like this.
Here are my testing thoughts -
1. that the file to copy exists
2. that the location to copy to exists
3. that the file copied successfully
I'm not sure if there is anything else (I'm sure there is).
Does anyone have any thoughts about what else I should be testing. Also, how many classes would you think would come out of this app.
I may be overthinking some of this, so any thoughts would be great.
Thanks
carl
MCSD, MCTS:MOSS
I am building a small application that is going to be used to move a file from one folder to another in a filesystem. I know that I can accomplish by using something similar to the following -
Code:
class Test
{
public static void Main()
{
string path = @"c:\temp\MyTest.txt";
string path2 = path + "temp";
try
{
// Create the file and clean up handles.
using (FileStream fs = File.Create(path)) {}
// Ensure that the target does not exist.
File.Delete(path2);
// Copy the file.
File.Copy(path, path2);
Console.WriteLine("{0} copied to {1}", path, path2);
// Try to copy the same file again, which should succeed.
File.Copy(path, path2, true);
Console.WriteLine("The second Copy operation succeeded, which was expected.");
}
catch
{
Console.WriteLine("Double copy is not allowed, which was not expected.");
}
}
}
However, I have been really trying to move more toward tdd. With that being said, what should I be testing in a simple app like this.
Here are my testing thoughts -
1. that the file to copy exists
2. that the location to copy to exists
3. that the file copied successfully
I'm not sure if there is anything else (I'm sure there is).
Does anyone have any thoughts about what else I should be testing. Also, how many classes would you think would come out of this app.
I may be overthinking some of this, so any thoughts would be great.
Thanks
carl
MCSD, MCTS:MOSS