public class MyHub : Hub
{
public IMyRepository MyRepository { get; }
public MyHub(IMyRepository myRepository)
{
MyRepository = myRepository;
}
public override async Task OnConnectedAsync()
{
foreach (var child in MyRepository.GetChildrecn())
{
await Groups.AddToGroupAsync(Context.ConnectionId, child.Id.Value);
}
await base.OnConnectedAsync();
}
}
I am stuck - I don't really get how to test such an easy hub. I want to make sure, that the Groups Property of the Hub is set accordingly. However most of the UnitTest projects just set the Groups/Clients as a Mock and the OnConnected is never called.
Anyone got some hints for me?