From 89542dd6adfa2a27019ed776813e52b35d5e9dfe Mon Sep 17 00:00:00 2001 From: Joel Mut Date: Thu, 25 Jul 2024 16:00:56 -0300 Subject: [PATCH] Update and fix WebexTeams issues --- .../Microsoft.Bot.Builder.Adapters.Webex.csproj | 2 +- .../WebexClientWrapper.cs | 2 +- .../WebexHelper.cs | 6 +++--- .../Bots/EchoBot.cs | 6 +++--- .../WebexAdapterTests.cs | 12 ++++++------ 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Webex/Microsoft.Bot.Builder.Adapters.Webex.csproj b/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Webex/Microsoft.Bot.Builder.Adapters.Webex.csproj index 66cd07145f..faafb86d7f 100644 --- a/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Webex/Microsoft.Bot.Builder.Adapters.Webex.csproj +++ b/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Webex/Microsoft.Bot.Builder.Adapters.Webex.csproj @@ -32,7 +32,7 @@ - + diff --git a/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Webex/WebexClientWrapper.cs b/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Webex/WebexClientWrapper.cs index 479542aac2..04e8277f4e 100644 --- a/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Webex/WebexClientWrapper.cs +++ b/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Webex/WebexClientWrapper.cs @@ -119,7 +119,7 @@ public virtual async Task DeleteMessageAsync(string messageId, CancellationToken /// Target for the message. /// A cancellation token for the task. /// The created message id. - public virtual async Task CreateMessageWithAttachmentsAsync(string recipient, string text, IList attachments, MessageTextType messageType = MessageTextType.Text, MessageTarget target = MessageTarget.PersonId, CancellationToken cancellationToken = default) + public virtual async Task CreateMessageWithAttachmentsAsync(string recipient, string text, IList attachments, MessageTextType messageType = MessageTextType.Text, MessageTarget target = MessageTarget.PersonId, CancellationToken cancellationToken = default) { Message result; diff --git a/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Webex/WebexHelper.cs b/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Webex/WebexHelper.cs index 6293f002ab..2c48c46186 100644 --- a/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Webex/WebexHelper.cs +++ b/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Webex/WebexHelper.cs @@ -213,11 +213,11 @@ public static Activity AttachmentActionToActivity(Message decryptedMessage, Pers /// /// The message with the files to process. /// A list of attachments containing the message's files. - public static List HandleMessageAttachments(Message message) + public static List HandleMessageAttachments(Message message) { - var attachmentsList = new List(); + var attachmentsList = new List(); - var attachment = new Attachment + var attachment = new Schema.Attachment { // Currently Webex API takes only one attachment ContentUrl = message.FileUris[0].AbsoluteUri, diff --git a/tests/Adapters/Microsoft.Bot.Builder.Adapters.Webex.TestBot/Bots/EchoBot.cs b/tests/Adapters/Microsoft.Bot.Builder.Adapters.Webex.TestBot/Bots/EchoBot.cs index e1d20bb8b0..8311ff59c6 100644 --- a/tests/Adapters/Microsoft.Bot.Builder.Adapters.Webex.TestBot/Bots/EchoBot.cs +++ b/tests/Adapters/Microsoft.Bot.Builder.Adapters.Webex.TestBot/Bots/EchoBot.cs @@ -25,7 +25,7 @@ protected override async Task OnMessageActivityAsync(ITurnContext + activity.Object.Attachments = new List { - new Attachment("image/png", "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQtB3AwMUeNoq4gUBGe6Ocj8kyh3bXa9ZbV7u1fVKQoyKFHdkqU"), + new Schema.Attachment("image/png", "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQtB3AwMUeNoq4gUBGe6Ocj8kyh3bXa9ZbV7u1fVKQoyKFHdkqU"), }; var turnContext = new TurnContext(webexAdapter, activity.Object); @@ -303,7 +303,7 @@ public async void SendActivitiesAsyncWithAttachmentActionsShouldSucceed() { const string expectedResponseId = "Mocked Response Id"; var webexApi = new Mock(_testOptions); - webexApi.Setup(x => x.CreateMessageWithAttachmentsAsync(It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(Task.FromResult(expectedResponseId)); + webexApi.Setup(x => x.CreateMessageWithAttachmentsAsync(It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(Task.FromResult(expectedResponseId)); var webexAdapter = new WebexAdapter(webexApi.Object, _adapterOptions); @@ -311,9 +311,9 @@ public async void SendActivitiesAsyncWithAttachmentActionsShouldSucceed() activity.Object.Type = "message"; activity.Object.Recipient = new ChannelAccount(id: "MockId"); activity.Object.Text = "Hello, Bot!"; - activity.Object.Attachments = new List + activity.Object.Attachments = new List { - new Attachment("application/vnd.microsoft.card.adaptive"), + new Schema.Attachment("application/vnd.microsoft.card.adaptive"), }; var turnContext = new TurnContext(webexAdapter, activity.Object); @@ -328,7 +328,7 @@ public async void SendActivitiesAsyncShouldSucceedAndNoActivityReturnedWithActiv { const string expectedResponseId = "Mocked Response Id"; var webexApi = new Mock(_testOptions); - webexApi.Setup(x => x.CreateMessageWithAttachmentsAsync(It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(Task.FromResult(expectedResponseId)); + webexApi.Setup(x => x.CreateMessageWithAttachmentsAsync(It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(Task.FromResult(expectedResponseId)); var webexAdapter = new WebexAdapter(webexApi.Object, _adapterOptions);