public Result AddStandardGame(string name, GameType gameType) { name = name.Trim(); var existingGameFound = this._games.FirstOrDefault(game => game.Name == name); if (existingGameFound != null) { return(Result.Failure("There is already a game with the same name. Please try with a different one")); } var draftGameResult = DraftGame.Create(name, gameType, STANDARD_BALLS_VERSION_TOTAL, STANDARD_BALLS_VERSION_PER_BUCKET_COUNT); if (draftGameResult.IsFailure) { return(draftGameResult); } this._games.Add(GameDTO.CreateFromDraftGame(draftGameResult.Value)); return(Result.Ok()); }
private Result <DraftGame> CreateGameWithoutPlayers(string withName = "Name 01", short withTotalBallsCount = 75, short withMaxNBallsPerBucket = 5, GameType withGameType = GameType.STANDARD) => DraftGame.Create(withName, withGameType, withTotalBallsCount, withMaxNBallsPerBucket);