Exemplo n.º 1
0
        public async Task GenerateNotificationsAsync_NoMentions_ShouldReturnDefaultNotification()
        {
            var subscriber = new Subscriber {
                ChatId = 1
            };

            _subscriptionService.Setup(x => x.GetAllSubscriptionsAsync()).ReturnsAsync(new[] { subscriber });

            var testData = new MessagesData {
                LatestMessageTimeStamp = DateTime.Now, MentionedUsernames = Array.Empty <string>()
            };
            var actual = (await _notificationProvider.GenerateNotificationsAsync(testData).ConfigureAwait(false)).ToArray();

            Assert.AreEqual(1, actual.Length);
            Assert.AreEqual(subscriber.ChatId, actual.First().ChatId);
            Assert.AreEqual("New Rocket.Chat message received", actual.First().Text);
        }