From 78a17bea2b658799cd8f88bca7cc7c55fe12fb6b Mon Sep 17 00:00:00 2001 From: Joel Mut Date: Fri, 22 Nov 2024 16:30:33 -0300 Subject: [PATCH] Change unit tests --- ...TeamsActivityHandlerNotImplementedTests.cs | 31 +--------------- .../Teams/TeamsActivityHandlerTests.cs | 37 ++----------------- 2 files changed, 5 insertions(+), 63 deletions(-) diff --git a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerNotImplementedTests.cs b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerNotImplementedTests.cs index ab02c199f6..2cc60cf9ae 100644 --- a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerNotImplementedTests.cs +++ b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerNotImplementedTests.cs @@ -718,36 +718,7 @@ void CaptureSend(Activity[] arg) } [Fact] - public async Task TestMessageFetchTaskDefault() - { - // Arrange - var activity = new Activity - { - Type = ActivityTypes.Invoke, - Name = "message/fetchTask" - }; - - Activity[] activitiesToSend = null; - void CaptureSend(Activity[] arg) - { - activitiesToSend = arg; - } - - var turnContext = new TurnContext(new SimpleAdapter(CaptureSend), activity); - - // Act - var bot = new TestActivityHandler(); - await ((IBot)bot).OnTurnAsync(turnContext); - - // Assert - Assert.NotNull(activitiesToSend); - Assert.Single(activitiesToSend); - Assert.IsType(activitiesToSend[0].Value); - Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); - } - - [Fact] - public async Task TestMessageFetchTaskCustom() + public async Task TestMessageFetchTask() { // Arrange var activity = new Activity diff --git a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerTests.cs b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerTests.cs index d607d65972..1bbf77cf9e 100644 --- a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerTests.cs +++ b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerTests.cs @@ -1556,38 +1556,7 @@ void CaptureSend(Activity[] arg) } [Fact] - public async Task TestMessageFetchTaskDefault() - { - // Arrange - var activity = new Activity - { - Type = ActivityTypes.Invoke, - Name = "message/fetchTask" - }; - - Activity[] activitiesToSend = null; - void CaptureSend(Activity[] arg) - { - activitiesToSend = arg; - } - - var turnContext = new TurnContext(new SimpleAdapter(CaptureSend), activity); - - // Act - var bot = new TestActivityHandler(); - await ((IBot)bot).OnTurnAsync(turnContext); - - // Assert - Assert.Single(bot.Record); - Assert.Equal("OnTeamsMessageFetchTaskAsync", bot.Record[0]); - Assert.NotNull(activitiesToSend); - Assert.Single(activitiesToSend); - Assert.IsType(activitiesToSend[0].Value); - Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); - } - - [Fact] - public async Task TestMessageFetchTaskCustom() + public async Task TestMessageFetchTask() { // Arrange var activity = new Activity @@ -1613,6 +1582,7 @@ void CaptureSend(Activity[] arg) Assert.Single(activitiesToSend); Assert.IsType(activitiesToSend[0].Value); Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal("http://testing", ((TaskModuleContinueResponse)((InvokeResponse)activitiesToSend[0].Value).Body).Value.Url); } private class NotImplementedAdapter : BotAdapter @@ -1960,7 +1930,8 @@ protected override Task OnTeamsMessageSubmitActionAsync(ITurnContext OnTeamsMessageFetchTaskAsync(ITurnContext turnContext, CancellationToken cancellationToken) { - var task = new TaskModuleContinueResponse(); + var info = new TaskModuleTaskInfo(url: "http://testing"); + var task = new TaskModuleContinueResponse(info); Record.Add(MethodBase.GetCurrentMethod().Name); return Task.FromResult(task); }