-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3919 from microsoft/tomlm/bug3980
Fix QnAMakerDialog to handle interuption scenarios
- Loading branch information
Showing
7 changed files
with
155 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
57 changes: 57 additions & 0 deletions
57
tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/DebugComposer.cs
This file contains 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,57 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
#pragma warning disable SA1118 // Parameter should not span multiple lines | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using Microsoft.Bot.Builder.Dialogs.Adaptive.Testing; | ||
using Microsoft.Bot.Builder.Dialogs.Declarative.Resources; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests | ||
{ | ||
[TestClass] | ||
public class DebugComposer | ||
{ | ||
public TestContext TestContext { get; set; } | ||
|
||
// This test can be used to debug a composer bot, simple point botPath => composer bot | ||
// and add debug.test.dialog script to that folder | ||
// { | ||
// "$schema": "../../../tests.schema", | ||
// "$kind": "Microsoft.Test.Script", | ||
// "dialog": "bot.root.dialog", | ||
// "script": [...] | ||
// } | ||
[Ignore] | ||
[TestMethod] | ||
public async Task DebugComposerBot() | ||
{ | ||
// luis.settings.{environment}.{region}.json | ||
var environment = Environment.UserName; | ||
var region = "westus"; | ||
var botPath = Path.Combine(TestUtils.GetProjectPath(), "Tests"); | ||
var testScript = "debug.test.dialog"; | ||
var locale = "en-US"; | ||
|
||
var resourceExplorer = new ResourceExplorer() | ||
.AddFolder(botPath, monitorChanges: false); | ||
|
||
// add luis settings if there are luis assets | ||
var resource = resourceExplorer.GetResource($"luis.settings.{environment}.{region}.json") as FileResource; | ||
var builder = new ConfigurationBuilder().AddInMemoryCollection(); | ||
if (resource != null) | ||
{ | ||
builder.AddJsonFile(resource.FullName); | ||
} | ||
|
||
var script = resourceExplorer.LoadType<TestScript>(testScript); | ||
script.Locale = locale; | ||
script.Configuration = builder.Build(); | ||
await script.ExecuteAsync(resourceExplorer: resourceExplorer).ConfigureAwait(false); | ||
} | ||
} | ||
} |
This file contains 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