You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/src/Ombi.Tests/SignalRHelper.cs

22 lines
683 B

using Moq;
using System.Collections.Generic;
using Microsoft.AspNetCore.SignalR;
namespace Ombi.Tests
{
public class SignalRHelper
{
public static Mock<IHubContext<T>> MockHub<T>() where T : Hub
{
Mock<IHubClients> mockClients = new Mock<IHubClients>();
Mock<IClientProxy> mockClientProxy = new Mock<IClientProxy>();
mockClients.Setup(clients => clients.Clients(It.IsAny<IReadOnlyList<string>>())).Returns(mockClientProxy.Object);
var hubContext = new Mock<IHubContext<T>>();
hubContext.Setup(x => x.Clients).Returns(() => mockClients.Object);
return hubContext;
}
}
}