Beispiel #1
0
        public void Setup()
        {
            _appFixture           = new ApplicationFixture();
            _roleService          = Substitute.For <IDiscordGuildRoleService>();
            _dateTime             = Substitute.For <IDateTime>();
            _roleConfiguration    = Substitute.For <IRoleConfiguration>();
            _directMessageService = Substitute.For <IDiscordDirectMessageService>();

            _dbContext      = Substitute.For <IApplicationDbContext>();
            _actionLogMock  = _dbContext.ConfigureMockDbSet(x => x.ModerationActionLogs);
            _activeMuteMock = _dbContext.ConfigureMockDbSet(x => x.ModerationActiveMutes);

            _currentUserService = Substitute.For <ICurrentUserService>();
            _currentUserId      = 14245;
            _currentUserService.UserId.Returns(_currentUserId.ToString());

            _roleId = 14245;
            _roleConfiguration.MuteRoleId.Returns(_roleId);

            _appFixture.OnConfigureServices += (_, services) =>
            {
                services.AddSingleton(_roleService);
                services.AddSingleton(_dbContext);
                services.AddSingleton(_dateTime);
                services.AddSingleton(_currentUserService);
                services.AddSingleton(_roleConfiguration);
                services.AddSingleton(_directMessageService);
            };
        }
Beispiel #2
0
 public RestrictChannelCommandHandler(IDiscordModerationService moderationService,
                                      IDateTime dateTime,
                                      IApplicationDbContext dbContext,
                                      IDiscordDirectMessageService directMessageService,
                                      ICurrentUserService currentUserService)
 {
     _moderationService    = moderationService;
     _dateTime             = dateTime;
     _dbContext            = dbContext;
     _directMessageService = directMessageService;
     _currentUserService   = currentUserService;
 }
Beispiel #3
0
 public MuteCommandHandler(IDiscordGuildRoleService roleService,
                           IDateTime dateTime,
                           IApplicationDbContext dbContext,
                           IRoleConfiguration roleConfiguration,
                           IDiscordDirectMessageService directMessageService,
                           ICurrentUserService currentUserService)
 {
     _roleService          = roleService;
     _dateTime             = dateTime;
     _dbContext            = dbContext;
     _roleConfiguration    = roleConfiguration;
     _directMessageService = directMessageService;
     _currentUserService   = currentUserService;
 }