Esempio n. 1
0
        public async Task CannotRemoveTeamWithPlayerOnIt()
        {
            const string playerName = "Alice";

            ByCommandTeamManager teamManager = new ByCommandTeamManager();

            Assert.IsTrue(teamManager.TryAddTeam(FirstTeam, out _), "Couldn't add the team");
            Assert.IsTrue(teamManager.TryAddPlayerToTeam(1, playerName, FirstTeam), "Couldn't add the player");
            Assert.IsFalse(
                teamManager.TryRemoveTeam(FirstTeam, out string message),
                "We shouldn't have been able to remove the team");
            Assert.IsNotNull(message, "We should have an error message");

            string playersTeamName = await teamManager.GetTeamIdOrNull(1);

            Assert.AreEqual(FirstTeam, playersTeamName, "Player should still be on the team");

            string teamNameFromId = await teamManager.GetTeamNameOrNull(FirstTeam);

            Assert.IsNotNull(teamNameFromId, "Team should still be there");
        }