Unit Testing Conditions for Directory.GetFiles

Viewed 2850

I've never used Unit tests before, but I am wanting to do so moving forward. Right now I have the simplest method I'm wanting to test:

public void GetAvailableFiles(string rootFolder)
{
   string[] dirs = Directory.GetFiles(rootFolder);
}

My unit test for this is as follows:

[Test]
public void CheckDirectory()
{     
   AvailableFile fileUpload = new AvailableFile();
   fileUpload.GetAvailableFiles("C:\\Input");      
}

When I debug this, I return all the files in my target location. However, I am struggling to come up with a valid condition in which this test can verify that it has passed.

My thinking was to have an expected count of files for this test. I have 10 files in there, so I should expect 10 results back. However, I am unsure how I could go about writing this with what I have.

How should I go about this?

3 Answers
Related