Trying to test a void method that sends an email whenever one action occurred. Most of the parameter in this method inside is hard coded. Based on the switch case mail subject also changes.
public void SendMail(ControllerContext, admin, userList)
{
try
{
var templatePath = string.Empty;
switch (pathid)
{
case 1:
templatePath = "XXX";
default:
break;
}
switch (urlId)
{
case 1:
viewModel.ItemUrl = "URL";
break;
default:
break;
}
foreach (var user in userList)
{
viewModel.FirstName = user.FirstName;
viewModel.LastName = user.LastName;
string bodyOftheContent = Generator.TemplateGeneration(ControllerContext, tempatePath);
Object.SendCustomMail(user.Email, bodyOftheContent, subject);
}
}
catch (Exception ex)
{
LogError("Error in sending notification email", ex, MethodBase.GetCurrentMethod());
}
}
Any possible way to unit test void method inside has lots of hard-coded values