public async Task GetTeamIdToNamesNoOverwritePermissions()
        {
            ByRoleTeamManager teamManager = CreateTeamManager();
            IReadOnlyDictionary <string, string> teamIdToName = await teamManager.GetTeamIdToNames();

            VerifyAllTeamsInTeamIdToName(teamIdToName);
        }
        public async Task GetTeamIdToNamesRolesInheritEveryoneAllowed()
        {
            ByRoleTeamManager teamManager = CreateTeamManager((roleId) => roleId != EveryoneRoleId ?
                                                              OverwritePermissions.InheritAll :
                                                              new OverwritePermissions(viewChannel: PermValue.Allow, sendMessages: PermValue.Allow));
            IReadOnlyDictionary <string, string> teamIdToName = await teamManager.GetTeamIdToNames();

            VerifyAllTeamsInTeamIdToName(teamIdToName);
        }
        public async Task GetTeamIdToNamesRolesInheritEveryoneSendOnly()
        {
            ByRoleTeamManager teamManager = CreateTeamManager((roleId) => roleId != EveryoneRoleId ?
                                                              OverwritePermissions.InheritAll :
                                                              new OverwritePermissions(viewChannel: PermValue.Deny, sendMessages: PermValue.Allow));
            IReadOnlyDictionary <string, string> teamIdToName = await teamManager.GetTeamIdToNames();

            Assert.AreEqual(0, teamIdToName.Count, "Unexpected number of teams");
        }
        public async Task GetTeamIdToNamesNoRolesEveryoneDeniedSend()
        {
            ByRoleTeamManager teamManager = CreateTeamManager((roleId) => roleId != EveryoneRoleId ?
                                                              (OverwritePermissions?)null :
                                                              new OverwritePermissions(sendMessages: PermValue.Deny));
            IReadOnlyDictionary <string, string> teamIdToName = await teamManager.GetTeamIdToNames();

            Assert.AreEqual(0, teamIdToName.Count, "Unexpected number of teams");
        }
        public async Task GetTeamIdToNames()
        {
            ByRoleTeamManager teamManager = CreateTeamManager();
            IReadOnlyDictionary <string, string> teamIdToName = await teamManager.GetTeamIdToNames();

            Assert.AreEqual(RoleIds.Length, teamIdToName.Count, "Unexpected number of teams");

            for (int i = 0; i < RoleIds.Length; i++)
            {
                Assert.IsTrue(
                    teamIdToName.TryGetValue(RoleIds[i].ToString(CultureInfo.InvariantCulture), out string teamName),
                    $"Couldn't get the team name for role ID {RoleIds[i]}");
                Assert.AreEqual(TeamNames[i], teamName, $"Unexpected team name for team #{i + 1}");
            }
        }
        public async Task GetTeamIdToNamesFirstAllowsSecondDeniedEveryoneAllowed()
        {
            ByRoleTeamManager teamManager = CreateTeamManager((roleId) =>
            {
                if (roleId == RoleIds[0] || roleId == EveryoneRoleId)
                {
                    return(new OverwritePermissions(viewChannel: PermValue.Allow, sendMessages: PermValue.Allow));
                }

                return(new OverwritePermissions(viewChannel: PermValue.Deny, sendMessages: PermValue.Deny));
            });

            IReadOnlyDictionary <string, string> teamIdToName = await teamManager.GetTeamIdToNames();

            VerifyOnlyOneTeamInTeamIdToName(teamIdToName);
        }
        public async Task GetTeamIdToNamesFirstPartialSecondInheritsEveryoneDenied()
        {
            ByRoleTeamManager teamManager = CreateTeamManager((roleId) =>
            {
                if (roleId == RoleIds[0])
                {
                    return(new OverwritePermissions(viewChannel: PermValue.Allow, sendMessages: PermValue.Inherit));
                }
                else if (roleId == EveryoneRoleId)
                {
                    return(new OverwritePermissions(viewChannel: PermValue.Deny, sendMessages: PermValue.Deny));
                }

                return(OverwritePermissions.InheritAll);
            });

            IReadOnlyDictionary <string, string> teamIdToName = await teamManager.GetTeamIdToNames();

            Assert.AreEqual(0, teamIdToName.Count, "Unexpected number of teams");
        }