// fluent syntax
subject.Invoking(y => y.Foo(null))
.Should().Throw<ArgumentNullException>();
// arrange-act-assert syntax
Action callingFooWithNull = () => subject.Foo(null);
callingFooWithNull.Should().Throw<ArgumentNullException>()
.WithParameterName("message");
[TestMethod]
public void ShouldThrowExceptionIfDirectorNotExistWhenDeletingDir()
{
var folder1 = rootPath + @"unknowfolder";
Assert.ThrowsException<Exception>(() => Util_Directory.DeleteDirectory(folder1));
}
[TestMethod]
public void FromDirectoryIsnullorEmptyUsingTryCatch()
{
try
{
var fromDir = "";
Util_Directory.Copy(fromDir, "", false, false);
}
catch (ArgumentException)
{
//test successfull here
return;
}
Assert.Fail("Call to Copy method did not fail");
}