I want to write a unit-test for the following codesnippet:
var attachment = new Attachment(path)
{
ContentId = Path.GetFileName(path)
};
return attachment;
Unfortunately the Attachment ctor throws a FileNotFoundException if I call the ctor with a fake path in the unit-test code.
How can I mock this code that I can verifiy whether the ContentId property was set correctly? I don't want to test the framework code.