private TestableLobby GetHub(string connectionId, StateChangeTracker clientState = null, IDictionary <string, Cookie> cookies = null, Mock <IGroupManager> groupManager = null, Mock <IGameHandler> gameHandler = null, Mock <IRegistrationHandler> registrationHandler = null, Mock <IUserHandler> userHandler = null, Mock <IMappingHandler> mappingHandler = null, Mock <IScenarioHandler> scenarioHandler = null) { clientState = clientState ?? new StateChangeTracker(); cookies = cookies ?? new Dictionary <string, Cookie>(); var lobby = new TestableLobby(gameHandler ?? new Mock <IGameHandler>(), registrationHandler ?? new Mock <IRegistrationHandler>(), userHandler ?? new Mock <IUserHandler>(), mappingHandler ?? new Mock <IMappingHandler>(), scenarioHandler ?? new Mock <IScenarioHandler>()); lobby.Clients = new HubConnectionContext(new Mock <IHubPipelineInvoker>().Object, new Mock <IConnection>().Object, "Lobby", connectionId, clientState); var request = new Mock <IRequest>(); request.Setup(a => a.Cookies).Returns(cookies); lobby.Context = new HubCallerContext(request.Object, connectionId); lobby.Groups = (groupManager ?? new Mock <IGroupManager>()).Object; return(lobby); }
private TestableLobby GetHub( string connectionId, StateChangeTracker clientState = null, IDictionary<string, Cookie> cookies = null, Mock<IGroupManager> groupManager = null, Mock<IGameHandler> gameHandler = null, Mock<IRegistrationHandler> registrationHandler = null, Mock<IUserHandler> userHandler = null, Mock<IMappingHandler> mappingHandler = null, Mock<IScenarioHandler> scenarioHandler = null ) { clientState = clientState ?? new StateChangeTracker(); cookies = cookies ?? new Dictionary<string, Cookie>(); var lobby = new TestableLobby( gameHandler ?? new Mock<IGameHandler>(), registrationHandler ?? new Mock<IRegistrationHandler>(), userHandler ?? new Mock<IUserHandler>(), mappingHandler ?? new Mock<IMappingHandler>(), scenarioHandler ?? new Mock<IScenarioHandler>() ); lobby.Clients = new HubConnectionContext( new Mock<IHubPipelineInvoker>().Object, new Mock<IConnection>().Object, "Lobby", connectionId, clientState ); var request = new Mock<IRequest>(); request.Setup( a => a.Cookies ).Returns( cookies ); lobby.Context = new HubCallerContext( request.Object, connectionId ); lobby.Groups = ( groupManager ?? new Mock<IGroupManager>() ).Object; return lobby; }