【发布时间】:2015-10-21 21:29:59
【问题描述】:
我想模拟以下采用参数的方法,以便使用假货和垫片进行单元测试。我不知道这对我来说是新的。任何想法都会有所帮助。
public string Renotify(int[] userIds)
{
var notify = new NotificationPublisher();
var message = "A request has been awaiting for your approval. Please check the application for details to approve the request ";
var subject = "Logos Approval Notification";
if (userIds.Length < 1)
return "Please select users to notify";
List<NotificationUser> userList = userIds.Select(t => new NotificationUser { userId = t }).ToList();
notify.SendNotification(userList, message, subject);
return "Success - Approvers Renotified";
}
【问题讨论】:
标签: c# unit-testing mocking microsoft-fakes shim