Exemplo n.º 1
0
        public async Task IsUserKickedAsync()
        {
            var loggingMock   = new Mock <ILoggingService>();
            var moderatorMock = new Mock <IUser>();
            var userMock      = new Mock <IGuildUser>();
            var contextMock   = new Mock <ICommandContext>();

            contextMock.Setup(c => c.User).Returns(moderatorMock.Object);

            var modModule = new ModerationModule(loggingMock.Object, null, null, null, null, null, null);

            modModule.SetContext(contextMock.Object);

            await modModule.KickUser(userMock.Object);

            userMock.Verify(user => user.KickAsync(It.IsAny <string>(), It.IsAny <RequestOptions>()), Times.Once);
        }
Exemplo n.º 2
0
        public async Task IsModeratorAndUserLoggedOnKickAsync()
        {
            var loggingMock       = new Mock <ILoggingService>();
            var moderatorMock     = new Mock <IUser>();
            var contextMock       = new Mock <ICommandContext>();
            var userMock          = new Mock <IGuildUser>();
            var expectedUser      = "******";
            var expectedModerator = "ModeratorName";

            userMock.Setup(u => u.Username).Returns(expectedUser);
            moderatorMock.Setup(mod => mod.Username).Returns(expectedModerator);
            contextMock.Setup(c => c.User).Returns(moderatorMock.Object);

            var modModule = new ModerationModule(loggingMock.Object, null, null, null, null, null, null);

            modModule.SetContext(contextMock.Object);

            await modModule.KickUser(userMock.Object);

            loggingMock.Verify(
                mock => mock.LogAction(It.Is <string>(message => message.Contains(expectedModerator) && message.Contains(expectedUser)),
                                       It.IsAny <bool>(), It.IsAny <bool>(), It.IsAny <Embed>()));
        }