From 870406dc5bcfbe3fd8edafc8d8f35e89ad23a37d Mon Sep 17 00:00:00 2001 From: Stepan Grankin Date: Sun, 9 Jun 2024 21:41:48 +0300 Subject: [PATCH] fixed NotifyAbout_AnyNotificationsAndUsers_SentAllNotificationsToAllUsers --- .../TelegramNotifyServiceTests.cs | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Dodo1000Bot.Messengers.Telegram.Tests/TelegramNotifyServiceTests.cs b/Dodo1000Bot.Messengers.Telegram.Tests/TelegramNotifyServiceTests.cs index db44422..c64d969 100644 --- a/Dodo1000Bot.Messengers.Telegram.Tests/TelegramNotifyServiceTests.cs +++ b/Dodo1000Bot.Messengers.Telegram.Tests/TelegramNotifyServiceTests.cs @@ -98,19 +98,13 @@ public async Task NotifyAbout_AnyNotificationsAndUsers_SentAllNotificationsToAll var ct = CancellationToken.None; _usersServiceMock.Setup(r => r.GetUsers(Source.Telegram, ct)).ReturnsAsync(new []{user}); - _clientMock.Setup(c => c.SendTextMessageAsync( - user.MessengerUserId, //ChatId chatId, - notification.Payload.Text, //string text, - It.IsAny(), //int? messageThreadId = null, - It.IsAny(), //ParseMode? parseMode = null, - It.IsAny>(), //IEnumerable? entities = null, - It.IsAny(), //bool? disableWebPagePreview = null, - It.IsAny(), //bool? disableNotification = null, - It.IsAny(), //bool? protectContent = null, - It.IsAny(), //int? replyToMessageId = null, - It.IsAny(), //bool? allowSendingWithoutReply = null, - It.IsAny(), //IReplyMarkup? replyMarkup = null, - ct)).ReturnsAsync(() => null); + _clientMock.Setup(c => c.MakeRequestAsync(It.IsAny(), ct)) + .Callback((IRequest request, CancellationToken _) => + { + var sendMessageRequest = request as SendMessageRequest; + Assert.AreEqual(sendMessageRequest?.Text, notification.Payload.Text); + Assert.AreEqual(sendMessageRequest?.ChatId, (ChatId)user.MessengerUserId); + }).ReturnsAsync(() => null); var pushedNotifications = (await _target.NotifyAbout(new []{notification}, ct)).ToArray();