I am struggling to work out how to unit test a method like the below:
public bool EmailSomething(OrderType order)
{
var subject = "Email Subject";
var body = File.ReadAllText("/EmailTemplates/Email.html");
body = body.Replace("#orderref#", order.OrderID.ToString());
if (SendEmail(new MailAddress("email@email.com"), subject, body))
{
return true;
}
return false;
}
The bit I am struggling with is the File.ReadAllText();
is returning an exception in a unit test since I am not referencing it correctly (for the unit test).
How would I unit test this method?