Exemplo n.º 1
0
        public async Task ShouldNotRevokeAnyRoles_WhenMutesThatAreNotExpiredExist(int secondsInFuture)
        {
            var now = DateTime.Now;

            _dateTime.Now.Returns(now);

            var activeMute = GenerateActiveMute(now.AddSeconds(secondsInFuture));

            _dbContext.ConfigureMockDbSet(x => x.ModerationActiveMutes, activeMute);

            await _appFixture.SendAsync(new UnMuteExpiredMutesCommand());

            await _roleService.DidNotReceiveWithAnyArgs().RevokeRoleAsync(default, default, default);
Exemplo n.º 2
0
        public async Task ShouldNotRevokeResultingRoleFromMember_WhenLevelRoleIsMarkedAsRemain()
        {
            var   level           = 4;
            ulong resultingRoleId = 553;
            ulong userId          = 69;

            _dbContext.ConfigureMockDbSet(x => x.LevelRoles, new LevelRole
            {
                Id     = 0,
                Remain = true,
                Lvl    = 4,
                RoleId = resultingRoleId
            });

            await _appFixture.SendAsync(new ApplyLevelRolesCommand
            {
                GuildId  = 1,
                MemberId = userId,
                Level    = level,
                RoleIds  = new[] { resultingRoleId }
            });

            await _roleService.DidNotReceiveWithAnyArgs().RevokeRoleAsync(default, default, default);
        public async Task ShouldNotRevokeResultingRoleFromMember_WhenConditionalRoleIsMarkedAsRemain()
        {
            ulong requiredRoleId  = 5;
            ulong resultingRoleId = 553;
            ulong userId          = 69;

            _dbContext.ConfigureMockDbSet(x => x.ConditionalRoles, new ConditionalRole
            {
                Id             = 0,
                Remain         = true,
                RequiredRoleId = requiredRoleId,
                ResultRoleId   = resultingRoleId
            });

            await _appFixture.SendAsync(new ApplyConditionalRolesCommand
            {
                GuildId = 1,
                Members = new Dictionary <ulong, ulong[]>
                {
                    { userId, new[] { resultingRoleId } }
                }
            });

            await _roleService.DidNotReceiveWithAnyArgs().RevokeRoleAsync(default, default, default);