Ejemplo n.º 1
0
        public void ShouldGetTimeoutAfterAddingReputation()
        {
            _dateTimeMock.Setup(dt => dt.Now).Returns(DateTime.Now);
            var expectedReputation = _data.Senne.Reputation.Value + 1;

            Assert.False(_reputationProvider.AddReputationHasTimeout(_data.Peter, _data.Senne));

            _reputationProvider.AddReputation(_data.Peter, _data.Senne);

            Assert.True(_reputationProvider.AddReputationHasTimeout(_data.Peter, _data.Senne));
            Assert.False(_reputationProvider.AddReputationHasTimeout(_data.Senne, _data.Peter));
            Assert.Equal(expectedReputation, _data.Senne.Reputation.Value);
        }
Ejemplo n.º 2
0
        public async Task GiveReputation(MiunieUser invoker, MiunieUser target, MiunieChannel c)
        {
            if (invoker.Id == target.Id)
            {
                await _discordMessages.SendMessage(c, PhraseKey.CANNOT_SELF_REP, invoker.Name);

                return;
            }

            if (_reputationProvider.AddReputationHasTimeout(invoker, target))
            {
                _logger.Log($"User '{invoker.Name}' has a reputation timeout for User '{target.Name}', ignoring...");
                return;
            }

            _reputationProvider.AddReputation(invoker, target);
            await _discordMessages.SendMessage(c, PhraseKey.REPUTATION_GIVEN, target.Name, invoker.Name);
        }