Hi I have following method in my class and I want to write unit test for it
using nunit and rhino mocks. My method moves all the folders from source
path to destination path, I am new to NUnit and Rhinomocks and I dont know
how to mock System.IO.Directory or System.IO.DirectoryInfo objects. I have
tried everything on google.
public void MoveDirectories()
{
var dirList = (from f in new
DirectoryInfo(sourceDir).EnumerateDirectories("*")
select f).ToList();
destinationDir = destinationDir + "//" + newDir;
foreach (var d in dirList)
{
if (GetWeekOfYear(d.CreationTime) == weekNo)
{
if (!Directory.Exists(destinationDir))
{
Directory.CreateDirectory(destinationDir);
}
if (!Directory.Exists(destinationDir + "//" + d.Name))
{
Console.WriteLine("Move Folder " + d.FullName + "
TO " + destinationDir + "//" + d.Name);
Directory.Move(d.FullName, destinationDir + "//" +
d.Name);
}
}
}
}
Here method GetWeekOfYear returns the Week number for a current date or
date supplied.
If any one can help me to achieve this.
Thanks in advance,
Mitz.
--
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rhinomocks.
For more options, visit https://groups.google.com/groups/opt_out.