This repository was archived by the owner on Jan 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 487
Adds check to TranscriptLoggerMiddleware doesn't log continue conversation event activities #4797
Merged
mrivera-ms
merged 3 commits into
main
from
gabog/TranscriptLoggerShouldNotLogContinueConversation
Oct 19, 2020
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Microsoft.Bot.Schema | ||
| { | ||
| /// <summary> | ||
| /// Define values for common event names used by activities of type <see cref="ActivityTypes.Event"/>. | ||
| /// </summary> | ||
| public static class EventActivityNames | ||
| { | ||
| /// <summary> | ||
| /// The event name for continuing a conversation. | ||
| /// </summary> | ||
| public const string ContinueConversation = "ContinueConversation"; | ||
|
|
||
| /// <summary> | ||
| /// The event name for creating a conversation. | ||
| /// </summary> | ||
| public const string CreateConversation = "CreateConversation"; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
tests/Microsoft.Bot.Builder.Tests/TranscriptLoggerMiddlewareTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.Bot.Builder.Adapters; | ||
| using Microsoft.Bot.Schema; | ||
| using Xunit; | ||
|
|
||
| namespace Microsoft.Bot.Builder.Tests | ||
| { | ||
| public class TranscriptLoggerMiddlewareTests | ||
| { | ||
| [Fact] | ||
| public async Task ShouldNotLogContinueConversation() | ||
| { | ||
| var transcriptStore = new MemoryTranscriptStore(); | ||
| var sut = new TranscriptLoggerMiddleware(transcriptStore); | ||
|
|
||
| var conversationId = Guid.NewGuid().ToString(); | ||
| var adapter = new TestAdapter(TestAdapter.CreateConversation(conversationId)) | ||
| .Use(sut); | ||
|
|
||
| await new TestFlow(adapter, async (context, cancellationToken) => | ||
| { | ||
| await context.SendActivityAsync("bar", cancellationToken: cancellationToken); | ||
| }) | ||
| .Send("foo") | ||
| .AssertReply(async activity => | ||
| { | ||
| Assert.Equal("bar", ((Activity)activity).Text); | ||
| var activities = await transcriptStore.GetTranscriptActivitiesAsync(activity.ChannelId, conversationId); | ||
| Assert.Equal(2, activities.Items.Length); | ||
| }) | ||
| .Send(new Activity(ActivityTypes.Event) { Name = EventActivityNames.ContinueConversation }) | ||
| .AssertReply(async activity => | ||
| { | ||
| // Ensure the event hasn't been added to the transcript. | ||
| var activities = await transcriptStore.GetTranscriptActivitiesAsync(activity.ChannelId, conversationId); | ||
| Assert.DoesNotContain(activities.Items, a => ((Activity)a).Type == ActivityTypes.Event && ((Activity)a).Name == EventActivityNames.ContinueConversation); | ||
| Assert.Equal(3, activities.Items.Length); | ||
| }) | ||
| .StartTestAsync(); | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.