Esempio n. 1
0
        public async Task OutputMessageTimeAsLocalAsync(ulong messageId, DateTimeOffset?createdTimeOffset, DateTimeOffset?editTimeOffset, MiunieUser user, MiunieChannel channel)
        {
            if (createdTimeOffset is null)
            {
                await _messages.SendMessageAsync(channel, PhraseKey.TIME_NO_MESSAGE, messageId.ToString());

                return;
            }

            var messageCreated = _timeManipulator.GetDateTimeLocalToUser(createdTimeOffset?.UtcDateTime, user);
            var messageEdited  = _timeManipulator.GetDateTimeLocalToUser(editTimeOffset?.UtcDateTime, user);

            if (messageEdited.HasValue)
            {
                await _messages.SendMessageAsync(channel, PhraseKey.TIME_MESSAGE_INFO_EDIT, messageId.ToString(), messageCreated, messageEdited);

                return;
            }

            await _messages.SendMessageAsync(channel, PhraseKey.TIME_MESSAGE_INFO_NO_EDIT, messageId.ToString(), messageCreated);
        }
        public void EnteredDateTimeIsNull_ReturnsNull()
        {
            var result = _provider.GetDateTimeLocalToUser(null, _dummyUsers.DraxWithUtcTimeOffSet);

            Assert.Null(result);
        }