public void SetUp() { this._playingTable = new PlayingTable(DUMMY_PLAYER_ID, "new table"); }
public void ShouldReturnTrue_WhenTheGivenPasswordIsWrong() { // Arrange var playingTable = new PlayingTable(DUMMY_PLAYER_ID, "Some Table Name", "1234"); // Act var result = playingTable.Authenticate("1234"); // Assert Assert.IsTrue(result); }
public void ShouldReturnTrue_WhenTheTableHasPassword() { // Arrange var playingTable = new PlayingTable(DUMMY_PLAYER_ID, "Some Table Name", "1234"); // Act var result = playingTable.HasPassword; // Assert Assert.IsTrue(result); }
/// <summary> /// Creates a new table with the given name /// </summary> /// <param name="playerId">The id of the player who created the table</param> /// <param name="name">The name of the table</param> /// <param name="password">The password of the table (optional)</param> /// <returns>The newly created table</returns> public IPlayingTable CreateTable(string playerId, string name, string password = null) { // should never be true. Validation should be done // on the above layers if (string.IsNullOrEmpty(name)) { throw new InvalidOperationException("The name of the table cannot be empty"); } var newTable = new PlayingTable(playerId, name, password) { Id = Guid.NewGuid().ToString() }; // subscribe to game can start event newTable.GameCanStart += this.GameCanStart; this.ActiveTables.Add(newTable); return newTable; }