我不知道如何为BroadcastChangeNotification()编写单元测试。有什么建议?我的意思是如何使用存根或填充来测试这个静态函数。伪造相关背景对我来说很难。也许我的问题应该是"如何检查ConfigurationChanged()是否被调用?"
public class ConfigurationHub : Hub
{
private static readonly IHubConnectionContext
ConnectionContext = GlobalHost
.ConnectionManager
.GetHubContext<ConfigurationHub>()
.Clients;
public static void BroadcastChangeNotification()
{
Task.Run(() => ConfigurationHub
.ConnectionContext
.All.ConfigurationChanged());
}
}