Ejemplo n.º 1
0
        public void AddPlayerAliases()
        {
            var players = repository.FindAllPlayers();

            var participatingPlayers = players.Where(p => p.Participating);

            foreach (var player in participatingPlayers)
            {
                if (player.Name.StartsWith("Mr ", System.StringComparison.OrdinalIgnoreCase))
                {
                    var baseName = player.Name.Substring(3);

                    var aliases = new List <string>
                    {
                        $"Mr. {baseName}",
                        $"Mr.{baseName}",
                        $"Mr{baseName}",
                        baseName,
                    };

                    player.AddAliases(aliases);

                    this.repository.UpsertPlayer(player);
                }
            }
        }
Ejemplo n.º 2
0
        public void FindAllPlayersNotInRepo()
        {
            var repo = new MongoRepository();

            var posters     = repo.FindAllPosts().Select(p => p.Poster).Distinct();
            var playerNames = repo.FindAllPlayers().Select(p => p.Name);

            var postersNotInRepo = posters.Where(p => !playerNames.Contains(p));

            repo.EnsurePlayersInRepo(postersNotInRepo, "1");
        }