public void CreateGame_ThrowsIfCreateGameFailed() { var connectionId = "123"; #region UserHandler var userHandler = new Mock <IUserHandler>(); userHandler.Setup(a => a.GetUser(connectionId)) .Returns(new User(connectionId, new RegisteredClient())); #endregion #region ScenarioHandler var scenarioHandler = new Mock <IScenarioHandler>(); scenarioHandler.Setup(a => a.ValidScenario(It.IsAny <string>())) .Returns(true); #endregion var hub = this.GetHub(connectionId, userHandler: userHandler, scenarioHandler: scenarioHandler); AssertIt.Throws <InvalidOperationException>(() => { hub.CreateGame("game-name", "scenario"); }); }
public void LeaveGame_ThrowsIfUserDoesntExist() { var connectionId = "123"; var hub = this.GetHub(connectionId); AssertIt.Throws <InvalidOperationException>(() => { hub.LeaveGame("game-id"); }); }
public void CreateGame_ThrowsIfUserDoesntExist() { var connectionId = "123"; var hub = this.GetHub(connectionId); AssertIt.Throws <InvalidOperationException>(() => { hub.CreateGame("game-name", "scenario"); }); }
public void LeaveGame_ThrowsIfGameDoesntExist() { var connectionId = "123"; #region UserHandler var userHandler = new Mock <IUserHandler>(); userHandler.Setup(a => a.GetUser(It.IsAny <string>())) .Returns(new User(connectionId, new RegisteredClient())); #endregion var hub = this.GetHub(connectionId, userHandler: userHandler); AssertIt.Throws <InvalidOperationException>(() => { hub.LeaveGame("game-id"); }); }
public void CreateGame_ThrowsIfScenarioDoesntExist() { var connectionId = "123"; #region UserHandler var userHandler = new Mock <IUserHandler>(); userHandler.Setup(a => a.GetUser(connectionId)) .Returns(new User(connectionId, new RegisteredClient())); #endregion var hub = this.GetHub(connectionId, userHandler: userHandler); AssertIt.Throws <InvalidOperationException>(() => { hub.CreateGame("game-name", "scenario"); }); }