From c317b35e240403b296ef22d6717f520090641a55 Mon Sep 17 00:00:00 2001 From: Darren Jefford Date: Mon, 15 Apr 2019 10:48:11 +0100 Subject: [PATCH 1/3] Skill Middleware to retrieve events Tests to validate Skill Middleware Skill Middleware added to all skills Removed old Skill Tests from Solutions project General stylecop warnings fixes --- .../SkillDialogTest.cs | 3 +- .../SkillDialogTestBase.cs | 2 + .../SkillMiddlewareTests.cs | 170 +++++++++++ .../SkillContext.cs | 31 +- .../SkillDialog.cs | 53 ++-- .../SkillException.cs | 2 +- .../SkillMiddleware.cs | 8 +- .../Extensions/DateTimeExTests.cs | 6 + .../Extensions/ListExTests.cs | 1 + ...crosoft.Bot.Builder.Solutions.Tests.csproj | 8 - .../FakeSkill/Dialogs/Auth/AuthDialog.cs | 41 --- .../Auth/Resources/SampleAuthResponses.cs | 18 -- .../Resources/SampleAuthResponses.de.json | Bin 20414 -> 0 bytes .../Resources/SampleAuthResponses.es.json | Bin 19690 -> 0 bytes .../Resources/SampleAuthResponses.fr.json | Bin 19798 -> 0 bytes .../Resources/SampleAuthResponses.it.json | Bin 19050 -> 0 bytes .../Auth/Resources/SampleAuthResponses.json | 24 -- .../Auth/Resources/SampleAuthResponses.tt | 3 - .../Resources/SampleAuthResponses.zh.json | 211 ------------- .../FakeSkill/Dialogs/Main/MainDialog.cs | 287 ------------------ .../Dialogs/Main/Resources/MainResponses.cs | 23 -- .../Main/Resources/MainResponses.de.json | Bin 4004 -> 0 bytes .../Main/Resources/MainResponses.es.json | Bin 3860 -> 0 bytes .../Main/Resources/MainResponses.fr.json | Bin 4040 -> 0 bytes .../Main/Resources/MainResponses.it.json | Bin 3948 -> 0 bytes .../Dialogs/Main/Resources/MainResponses.json | 83 ----- .../Dialogs/Main/Resources/MainResponses.tt | 3 - .../Main/Resources/MainResponses.zh.json | 82 ----- .../Sample/Resources/SampleResponses.cs | 18 -- .../Sample/Resources/SampleResponses.de.json | Bin 20414 -> 0 bytes .../Sample/Resources/SampleResponses.es.json | Bin 19690 -> 0 bytes .../Sample/Resources/SampleResponses.fr.json | Bin 19798 -> 0 bytes .../Sample/Resources/SampleResponses.it.json | Bin 19050 -> 0 bytes .../Sample/Resources/SampleResponses.json | 24 -- .../Sample/Resources/SampleResponses.tt | 3 - .../Sample/Resources/SampleResponses.zh.json | 211 ------------- .../FakeSkill/Dialogs/Sample/SampleDialog.cs | 65 ---- .../DialogOptions/SkillDialogOptions.cs | 7 - .../Dialogs/Shared/FakeSkillDialog.cs | 202 ------------ .../Dialogs/Shared/Resources/FakeSkillLU.cs | 61 ---- .../Shared/Resources/ResponseIdCollection.t4 | 31 -- .../Shared/Resources/SharedResponses.cs | 22 -- .../Shared/Resources/SharedResponses.de.json | Bin 11500 -> 0 bytes .../Shared/Resources/SharedResponses.es.json | Bin 10198 -> 0 bytes .../Shared/Resources/SharedResponses.fr.json | Bin 11096 -> 0 bytes .../Shared/Resources/SharedResponses.it.json | Bin 10412 -> 0 bytes .../Shared/Resources/SharedResponses.json | 148 --------- .../Shared/Resources/SharedResponses.tt | 3 - .../Shared/Resources/SharedResponses.zh.json | 211 ------------- .../Skills/Fakes/FakeSkill/FakeSkill.cs | 88 ------ .../ServiceClients/IServiceManager.cs | 6 - .../ServiceClients/ServiceManager.cs | 9 - .../Fakes/FakeSkill/SkillConversationState.cs | 17 -- .../Skills/Fakes/FakeSkill/SkillUserState.cs | 15 - .../Skills/InvokeSkillTests.cs | 135 -------- .../Skills/LuisTestUtils/FakeSkillTestUtil.cs | 42 --- .../Skills/LuisTestUtils/GeneralTestUtil.cs | 47 --- .../Skills/MisconfiguredSkillTest.cs | 47 --- .../Skills/SkillTestBase.cs | 153 ---------- .../Utterances/GeneralUtterances.Designer.cs | 144 --------- .../Skills/Utterances/GeneralUtterances.resx | 147 --------- .../SampleDialogUtterances.Designer.cs | 90 ------ .../Utterances/SampleDialogUtterances.resx | 129 -------- .../Adapters/AutomotiveSkillAdapter.cs | 1 + .../Adapters/CalendarSkillAdapter.cs | 4 +- .../emailskill/Adapters/EmailSkillAdapter.cs | 4 +- .../newsskill/Adapters/NewsSkillAdapter.cs | 1 + .../Adapters/RestaurantSkillAdapter.cs | 1 + .../Adapters/POISkillAdapter.cs | 4 +- .../todoskill/Adapters/ToDoSkillAdapter.cs | 1 + 70 files changed, 229 insertions(+), 2921 deletions(-) create mode 100644 lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills.Tests/SkillMiddlewareTests.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/AuthDialog.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.de.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.es.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.fr.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.it.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.tt delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.zh.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/MainDialog.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.de.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.es.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.fr.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.it.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.tt delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.zh.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.de.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.es.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.fr.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.it.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.tt delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.zh.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/SampleDialog.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/DialogOptions/SkillDialogOptions.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/FakeSkillDialog.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/FakeSkillLU.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/ResponseIdCollection.t4 delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.de.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.es.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.fr.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.it.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.tt delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.zh.json delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/FakeSkill.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/ServiceClients/IServiceManager.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/ServiceClients/ServiceManager.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/SkillConversationState.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/SkillUserState.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/InvokeSkillTests.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/LuisTestUtils/FakeSkillTestUtil.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/LuisTestUtils/GeneralTestUtil.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/MisconfiguredSkillTest.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/SkillTestBase.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/GeneralUtterances.Designer.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/GeneralUtterances.resx delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/SampleDialogUtterances.Designer.cs delete mode 100644 lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/SampleDialogUtterances.resx diff --git a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills.Tests/SkillDialogTest.cs b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills.Tests/SkillDialogTest.cs index c9c300a6dd..693231e4bc 100644 --- a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills.Tests/SkillDialogTest.cs +++ b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills.Tests/SkillDialogTest.cs @@ -14,10 +14,11 @@ namespace Microsoft.Bot.Builder.Skills.Tests internal class SkillDialogTest : SkillDialog { private MockHttpMessageHandler _mockHttpMessageHandler; + public SkillDialogTest(SkillManifest skillManifest, ResponseManager responseManager, MicrosoftAppCredentialsEx microsoftAppCredentialsEx, IBotTelemetryClient telemetryClient, MockHttpMessageHandler mockHttpMessageHandler, UserState userState) : base(skillManifest, responseManager, microsoftAppCredentialsEx, telemetryClient, userState) { _mockHttpMessageHandler = mockHttpMessageHandler; - _httpClient = mockHttpMessageHandler.ToHttpClient(); + HttpClient = mockHttpMessageHandler.ToHttpClient(); } } } diff --git a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills.Tests/SkillDialogTestBase.cs b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills.Tests/SkillDialogTestBase.cs index 2e4fbae785..15c38013ea 100644 --- a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills.Tests/SkillDialogTestBase.cs +++ b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills.Tests/SkillDialogTestBase.cs @@ -16,7 +16,9 @@ namespace Microsoft.Bot.Builder.Skills.Tests public class SkillDialogTestBase : BotTestBase { public IServiceCollection Services { get; set; } + public DialogSet Dialogs { get; set; } + public UserState UserState { get; set; } public IStatePropertyAccessor SkillContextAccessor { get; set; } diff --git a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills.Tests/SkillMiddlewareTests.cs b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills.Tests/SkillMiddlewareTests.cs new file mode 100644 index 0000000000..4bfec83232 --- /dev/null +++ b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills.Tests/SkillMiddlewareTests.cs @@ -0,0 +1,170 @@ +using Microsoft.Bot.Builder.Adapters; +using Microsoft.Bot.Builder.Solutions.Testing; +using Microsoft.Bot.Schema; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Bot.Builder.Skills.Tests +{ + [TestClass] + public class SkillMiddlewareTests + { + private ServiceCollection _serviceCollection; + private UserState _userState; + private IStatePropertyAccessor _skillContextAccessor; + + [TestInitialize] + public void AddSkillManifest() + { + // Initialize service collection + _serviceCollection = new ServiceCollection(); + + var conversationState = new ConversationState(new MemoryStorage()); + _serviceCollection.AddSingleton(conversationState); + _userState = new UserState(new MemoryStorage()); + _skillContextAccessor = _userState.CreateProperty(nameof(SkillContext)); + _serviceCollection.AddSingleton(_userState); + + _serviceCollection.AddSingleton(sp => + { + return new BotStateSet(_userState, conversationState); + }); + + _serviceCollection.AddSingleton(); + + } + + [TestMethod] + public async Task SkillMiddlewarePopulatesSkillContext() + { + string jsonSkillBeginActivity = await File.ReadAllTextAsync(@".\TestData\skillBeginEvent.json"); + var skillBeginEvent = JsonConvert.DeserializeObject(jsonSkillBeginActivity); + + var skillContextData = new SkillContext(); + skillContextData.Add("PARAM1", "TEST1"); + skillContextData.Add("PARAM2", "TEST2"); + + // Ensure we have a copy + skillBeginEvent.Value = new SkillContext(skillContextData); + + TestAdapter adapter = new TestAdapter() + .Use(new SkillMiddleware(_userState)); + + var testFlow = new TestFlow(adapter, async (context, cancellationToken) => + { + // Validate that SkillContext has been populated by the SKillMiddleware correctly + await ValidateSkillContextData(context, skillContextData); + }); + + await testFlow.Test(new Activity[] { skillBeginEvent }).StartTestAsync(); + } + + [TestMethod] + public async Task SkillMiddlewarePopulatesSkillContextDifferentDatatypes() + { + string jsonSkillBeginActivity = await File.ReadAllTextAsync(@".\TestData\skillBeginEvent.json"); + var skillBeginEvent = JsonConvert.DeserializeObject(jsonSkillBeginActivity); + + var skillContextData = new SkillContext(); + skillContextData.Add("PARAM1", DateTime.Now); + skillContextData.Add("PARAM2", 3); + skillContextData.Add("PARAM3", null); + + // Ensure we have a copy + skillBeginEvent.Value = new SkillContext(skillContextData); + + TestAdapter adapter = new TestAdapter() + .Use(new SkillMiddleware(_userState)); + + var testFlow = new TestFlow(adapter, async (context, cancellationToken) => + { + // Validate that SkillContext has been populated by the SKillMiddleware correctly + await ValidateSkillContextData(context, skillContextData); + }); + + await testFlow.Test(new Activity[] { skillBeginEvent }).StartTestAsync(); + } + + [TestMethod] + public async Task SkillMiddlewareEmptySkillContext() + { + string jsonSkillBeginActivity = await File.ReadAllTextAsync(@".\TestData\skillBeginEvent.json"); + var skillBeginEvent = JsonConvert.DeserializeObject(jsonSkillBeginActivity); + + // Ensure we have a copy + skillBeginEvent.Value = new SkillContext(); + + TestAdapter adapter = new TestAdapter() + .Use(new SkillMiddleware(_userState)); + + var testFlow = new TestFlow(adapter, async (context, cancellationToken) => + { + // Validate that SkillContext has been populated by the SKillMiddleware correctly + await ValidateSkillContextData(context, new SkillContext()); + }); + + await testFlow.Test(new Activity[] { skillBeginEvent }).StartTestAsync(); + } + + [TestMethod] + public async Task SkillMiddlewareNullSlotData() + { + string jsonSkillBeginActivity = await File.ReadAllTextAsync(@".\TestData\skillBeginEvent.json"); + var skillBeginEvent = JsonConvert.DeserializeObject(jsonSkillBeginActivity); + + skillBeginEvent.Value = null; + + TestAdapter adapter = new TestAdapter() + .Use(new SkillMiddleware(_userState)); + + var testFlow = new TestFlow(adapter, async (context, cancellationToken) => + { + }); + + await testFlow.Test(new Activity[] { skillBeginEvent }).StartTestAsync(); + } + + [TestMethod] + public async Task SkillMiddlewareNullEventName() + { + string jsonSkillBeginActivity = await File.ReadAllTextAsync(@".\TestData\skillBeginEvent.json"); + var skillBeginEvent = JsonConvert.DeserializeObject(jsonSkillBeginActivity); + + skillBeginEvent.Name = null; + + TestAdapter adapter = new TestAdapter() + .Use(new SkillMiddleware(_userState)); + + var testFlow = new TestFlow(adapter, async (context, cancellationToken) => + { + }); + + await testFlow.Test(new Activity[] { skillBeginEvent }).StartTestAsync(); + } + + private async Task ValidateSkillContextData(ITurnContext context, Dictionary skillTestDataToValidate) + { + var accessor = _userState.CreateProperty(nameof(SkillContext)); + var skillContext = await _skillContextAccessor.GetAsync(context, () => new SkillContext()); + + Assert.IsTrue( + skillContext.SequenceEqual(skillTestDataToValidate), + $"SkillContext didn't contain the expected data after Skill middleware processing: {CreateCollectionMismatchMessage(skillContext, skillTestDataToValidate)} "); + } + + private string CreateCollectionMismatchMessage (SkillContext context, Dictionary test) + { + var contextData = string.Join(",", context.Select(x => x.Key + "=" + x.Value)); + var testData = string.Join(",", test.Select(x => x.Key + "=" + x.Value)); + + return $"Expected: {testData}, Actual: {contextData}"; + } + } +} diff --git a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillContext.cs b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillContext.cs index d4687a3512..e1bf63de6c 100644 --- a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillContext.cs +++ b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillContext.cs @@ -7,40 +7,15 @@ namespace Microsoft.Bot.Builder.Skills /// /// Context to share state between Bots and Skills. /// - public class SkillContext + public class SkillContext : Dictionary { - private readonly Dictionary _contextStorage = new Dictionary(); - public SkillContext() { } - public SkillContext(Dictionary data) - { - _contextStorage = data; - } - - public int Count - { - get { return _contextStorage.Count; } - } - - public object this[string name] - { - get - { - return _contextStorage[name]; - } - - set - { - _contextStorage[name] = value; - } - } - - public bool TryGetValue(string key, out object value) + public SkillContext(IDictionary collection) + : base(collection) { - return _contextStorage.TryGetValue(key, out value); } } } diff --git a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillDialog.cs b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillDialog.cs index d3f20f5484..3e8762ef91 100644 --- a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillDialog.cs +++ b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillDialog.cs @@ -25,7 +25,7 @@ namespace Microsoft.Bot.Builder.Skills /// public class SkillDialog : ComponentDialog { - protected HttpClient _httpClient = new HttpClient(); + private HttpClient _httpClient = new HttpClient(); private readonly MultiProviderAuthDialog _authDialog; private MicrosoftAppCredentialsEx _microsoftAppCredentialsEx; private IBotTelemetryClient _telemetryClient; @@ -44,8 +44,8 @@ public class SkillDialog : ComponentDialog /// Proactive State. /// Endpoint Service. /// Telemetry Client. - /// Background Task Queue. - /// Use Cached Tokens. + /// User State. + /// Auth Dialog. public SkillDialog(SkillManifest skillManifest, ResponseManager responseManager, MicrosoftAppCredentialsEx microsoftAppCredentialsEx, IBotTelemetryClient telemetryClient, UserState userState, MultiProviderAuthDialog authDialog = null) : base(skillManifest.Id) { @@ -61,6 +61,9 @@ public SkillDialog(SkillManifest skillManifest, ResponseManager responseManager, } } + // Protected to enable mocking + protected HttpClient HttpClient { get => _httpClient; set => _httpClient = value; } + /// /// When a SkillDialog is started, a skillBegin event is sent which firstly indicates the Skill is being invoked in Skill mode, also slots are also provided where the information exists in the parent Bot. /// @@ -70,6 +73,12 @@ public SkillDialog(SkillManifest skillManifest, ResponseManager responseManager, /// dialog turn result. protected override async Task OnBeginDialogAsync(DialogContext innerDc, object options, CancellationToken cancellationToken = default(CancellationToken)) { + SkillContext slots = new SkillContext(); + + // Retrieve the SkillContext state object to identify slots (parameters) that can be used to slot-fill when invoking the skill + var accessor = _userState.CreateProperty(nameof(SkillContext)); + var skillContext = await accessor.GetAsync(innerDc.Context, () => new SkillContext()); + var actionName = options as string; if (actionName == null) { @@ -78,34 +87,26 @@ public SkillDialog(SkillManifest skillManifest, ResponseManager responseManager, else { _action = _skillManifest.Actions.Single(a => a.Id == actionName); - if (_action == null) + if (_action != null) { - throw new ArgumentException($"Passed Action ({actionName}) could not be found within the {_skillManifest.Id} skill manifest action definition."); - } - } - - // Retrieve the SkillContext state object to identify slots (parameters) that can be used - // to slot-fill when invoking the skill - var accessor = _userState.CreateProperty(nameof(SkillContext)); - var skillContext = await accessor.GetAsync(innerDc.Context, () => new SkillContext()); - - Dictionary slotsToPass = new Dictionary(); - - // If we don't have any state then we skip Slot filling - if (skillContext != null && skillContext.Count > 0) - { - // Do we have slots? - if (_action != null && _action.Definition.Slots != null) - { - // For each slot we check to see if there is an exact match, if so we pass this slot across to the skill - foreach (Slot slot in _action.Definition.Slots) + // If the action doesn't define any Slots or SkillContext is empty then we skip slot evaluation + if (_action.Definition.Slots != null && skillContext.Count > 0) { - if (skillContext.TryGetValue(slot.Name, out object slotValue)) + foreach (Slot slot in _action.Definition.Slots) { - slotsToPass.Add(slot.Name, slotValue); + // For each slot we check to see if there is an exact match, if so we pass this slot across to the skill + if (skillContext.TryGetValue(slot.Name, out object slotValue)) + { + slots.Add(slot.Name, slotValue); + } } } } + else + { + // Loosening checks for current Dispatch evaluation, TODO - Review + // throw new ArgumentException($"Passed Action ({actionName}) could not be found within the {_skillManifest.Id} skill manifest action definition."); + } } var activity = innerDc.Context.Activity; @@ -117,7 +118,7 @@ public SkillDialog(SkillManifest skillManifest, ResponseManager responseManager, recipient: new ChannelAccount(id: activity.Recipient.Id, name: activity.Recipient.Name), conversation: new ConversationAccount(id: activity.Conversation.Id), name: SkillEvents.SkillBeginEventName, - value: slotsToPass); + value: slots); // Send skillBegin event to Skill/Bot return await ForwardToSkill(innerDc, skillBeginEvent); diff --git a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillException.cs b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillException.cs index 629cdfb1a2..425cedbe23 100644 --- a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillException.cs +++ b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillException.cs @@ -17,7 +17,7 @@ public enum SkillExceptionType /// /// Other types of exceptions /// - Other + Other, } public class SkillException : Exception diff --git a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillMiddleware.cs b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillMiddleware.cs index 1d71f8c703..d35dcafa91 100644 --- a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillMiddleware.cs +++ b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillMiddleware.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Microsoft.Bot.Builder.Skills.Models; using Microsoft.Bot.Schema; +using Newtonsoft.Json; namespace Microsoft.Bot.Builder.Skills { @@ -22,12 +23,11 @@ public SkillMiddleware(UserState userState) { // The skillBegin event signals the start of a skill conversation to a Bot. var activity = turnContext.Activity; - if (activity != null && activity.Type == ActivityTypes.Event && activity?.Name == SkillEvents.SkillBeginEventName) + if (activity != null && activity.Type == ActivityTypes.Event && activity.Name == SkillEvents.SkillBeginEventName && activity.Value != null) { - if (activity.Value is Dictionary slotData) + var skillContext = activity.Value as SkillContext; + if (skillContext != null) { - // If we have slotData then we create the SkillContext object within UserState for the skill to access - SkillContext skillContext = new SkillContext(slotData); var accessor = _userState.CreateProperty(nameof(SkillContext)); await accessor.SetAsync(turnContext, skillContext); } diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Extensions/DateTimeExTests.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Extensions/DateTimeExTests.cs index da4f9f9920..0968e4e5d0 100644 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Extensions/DateTimeExTests.cs +++ b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Extensions/DateTimeExTests.cs @@ -117,11 +117,17 @@ public DateTimeTestData(string culture) { Culture = new CultureInfo(culture); } + public CultureInfo Culture { get; } + public DateTime InputDateTime { get; set; } + public string ExpectedDateSpeech { get; set; } + public string ExpectedDateSpeechWithSuffix { get; set; } + public string ExpectedTimeSpeech { get; set; } + public string ExpectedTimeSpeechWithSuffix { get; set; } } } diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Extensions/ListExTests.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Extensions/ListExTests.cs index d78bb436a3..757b95b055 100644 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Extensions/ListExTests.cs +++ b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Extensions/ListExTests.cs @@ -39,6 +39,7 @@ public void ToSpeechString() private class SomeComplexType { public string Number { get; set; } + public object SomeOtherProperty { get; set; } } } diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Microsoft.Bot.Builder.Solutions.Tests.csproj b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Microsoft.Bot.Builder.Solutions.Tests.csproj index 4c9f7dfeea..d0ead6771d 100644 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Microsoft.Bot.Builder.Solutions.Tests.csproj +++ b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Microsoft.Bot.Builder.Solutions.Tests.csproj @@ -83,14 +83,6 @@ - - - True - True - SampleAuthResponses.tt - - - diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/AuthDialog.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/AuthDialog.cs deleted file mode 100644 index f20b68194b..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/AuthDialog.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Bot.Builder; -using Microsoft.Bot.Builder.Dialogs; -using Microsoft.Bot.Builder.Solutions.Skills; -using FakeSkill.Dialogs.Shared; -using FakeSkill.ServiceClients; -using Microsoft.Bot.Builder.Solutions.Responses; - -namespace FakeSkill.Dialogs.Auth -{ - public class AuthDialog : SkillTemplateDialog - { - public AuthDialog( - SkillConfigurationBase services, - ResponseManager responseManager, - IStatePropertyAccessor conversationStateAccessor, - IStatePropertyAccessor userStateAccessor, - IServiceManager serviceManager, - IBotTelemetryClient telemetryClient) - : base(nameof(AuthDialog), services, responseManager, conversationStateAccessor, userStateAccessor, serviceManager, telemetryClient) - { - var sample = new WaterfallStep[] - { - GetAuthToken, - End, - }; - - AddDialog(new WaterfallDialog(nameof(AuthDialog), sample)); - } - - private Task End(WaterfallStepContext stepContext, CancellationToken cancellationToken) - { - return stepContext.EndDialogAsync(); - } - - private class DialogIds - { - } - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.cs deleted file mode 100644 index 7796c4dfe8..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.cs +++ /dev/null @@ -1,18 +0,0 @@ -// https://docs.microsoft.com/en-us/visualstudio/modeling/t4-include-directive?view=vs-2017 -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Microsoft.Bot.Builder.Solutions.Responses; - -namespace Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Auth.Resources -{ - /// - /// Contains bot responses. - /// - public class SampleAuthResponses : IResponseIdCollection - { - // Generated accessors - public const string MessagePrompt = "MessagePrompt"; - public const string MessageResponse = "MessageResponse"; - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.de.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.de.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Ny`f@Bb2s>_j@{y7k3#qWjoCZ5czTl)zgo zJLDI6HXCAKo79!&FsKm@L|ZU9|)R2@y{=kaqttDe;4U&>HW=Tth9 z6U~-+2d$|;KJAv-L}Xj7-#WxMGR$i451!7X7CYX}lT~{Fwxn&buL_^Z87Vn-@RZCo zue06i=OMG0*VkUX%P1yNuoCq-e0J%~3>w&*G%9$Sywi4d^S~R|e`}@-W6k}NTHkOeS0WS-^sdlW6c<+e|_MWSCj;%NT Vm07LMfpjFtVit{c%x}H9{{z|43OxV- diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.it.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.it.json deleted file mode 100644 index e8f6e499a0828a73ca969ba0e786a2f395e4099a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19050 zcmeI4&2C#o6vt2|fMw!+v-ZPQ%aPK+li#I0%C< z3vc!4hc7jwnrrjV!zi4E<1o>y&-wo5dd%Uk{ww?COurlH>Tj>F%-W}6sz*=XaNU_6 z({Q0{bA^j*N_I8lGLBzqe5AEU;Ut+kjbq2*^Xu=XVHmIZAyPThbq>NWaqTPZs2?6Q zsO@XcD7@FR?YS$;Tq@4Rs~V+0%u(JKpQhT^rRaVV-&gcc!Z>pFJdTgU)0>(7n`>Sr z*X!TN|FI--F8-Z|=iR9G7pX~gp=`y)N0EfcLh)Y=aucXZ<<9Ez@iJ`JU{ zBfb8l-47&ZBo3v$@P{4)?e<8|7f}z;0QST4XRY!#YUXud8?-bf-qg;fEiK~Se&ik; zcqi^4``3C5Z#aP!VL>io<1F*Azf=8cpjY?`@Bh*(Hh3;xPQt?s&TX2GvRwN%Q-{#T z6LF*$`I72sj&_w@wJb;Wr335R+Cy<@PrN;iyjo7nzRJ?FE~zZb@pfO+i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=_t!J>z$#i>rd@}zAwje={M3BvJO9WGqkmcS2?kCGpm>7 zP+gw%IFOGK0}M}4ALNtQPwdPnwJ@uBFtUix#!)H>i*+!EuXl;&veMWSuc`9bSu{Ka z^9|yO4z(Y?$>G$p*DJdV*L$cPi)znAs56;Aa&02Q;K8k~<+UdB`hQM7X{h*iYhGSPWp=O` zNm*QP`l{u3mv&=Y9zXB7{G>4t2fL+jpTe@7{!KbbWeyFtyNS%BH&0ud$hmu;bvLPR zN+=!4!5FJmpVJeGU3nizYusta75zT6`UzcMzG=042d(zi?0m;Y=q%tAiHa|@cxBD+ zJHh(s6Y^RKx=4ipUs-jR=47a4S4}0iK0bJvkxhHWU2%)b zka-vI!?=@f&0SGo_qyT--1@5%cI(-(4Ba}wR=vw}{gqPrtnd47qX(Hx;#stxLvykK zhjQvr>#b6D$1kGA($`K+#c;OY6JY01X4#9X-18M0M__h6?A-fb$s--d=JBgb8q0FK z>D95N6aA4h5pAun0pH3=MAb*>otuZ6$?28dn@^1yZ@~$JW#yhr%++mpy)~QMNJny_j%T4c^*-zPsP{61aH#`=d7taC?f>DB(;w>* z$UIKHhr>?kyce3>p|U8OU)7f9`#5_3~8gM z&{ap$ZsnG7RP%H6^`4_?uJ&IXO>NH*MLLpWjrlz(J3@b0A|C9q9(ea{bq3RmjHb86 zBI~i>oSaM;EnPkiS(X60u!!dWX@xt>9UbIoa@TaG+OR(2+}}#HT5px+j?3 Jaecct|6g@XJDval diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.json deleted file mode 100644 index 71c9a251c5..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "MessagePrompt": { - "replies": [ - { - "text": "Please type your message.", - "speak": "Please type your message." - }, - { - "text": "Try saying something for this dialog.", - "speak": "Try saying something for this dialog." - } - ], - "inputHint": "expectingInput" - }, - "MessageResponse": { - "replies": [ - { - "text": "You said: {Message}", - "speak": "You said: {Message}" - } - ], - "inputHint": "acceptingInput" - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.tt b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.tt deleted file mode 100644 index d636d96c8b..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.tt +++ /dev/null @@ -1,3 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ output extension=".cs" #> -<#@ include file="..\..\Shared\Resources\ResponseIdCollection.t4"#> diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.zh.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.zh.json deleted file mode 100644 index 44c91b5ec1..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Auth/Resources/SampleAuthResponses.zh.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "DidntUnderstandMessage": { - "replies": [ - { - "text": "对不起,没有明白你的意思。", - "speak": "对不起,没有明白你的意思。" - }, - { - "text": "我没有明白你的意思,你能以不同的方式尝试吗?", - "speak": "我没有明白你的意思,你能以不同的方式尝试吗?" - }, - { - "text": "你能以不同的方式说出来吗?", - "speak": "你能以不同的方式说出来吗?" - }, - { - "text": "你能再试一次问我,我没听懂你的意思。", - "speak": "你能再试一次问我,我没听懂你的意思。" - } - ], - "inputHint": "acceptingInput" - }, - "NoAuth": { - "replies": [ - { - "text": "请登录,以便我采取进一步行动。", - "speak": "请登录,以便我采取进一步行动。" - } - ], - "inputHint": "expectingInput" - }, - "AuthFailed": { - "replies": [ - { - "text": "您的登录失败,请稍后再试。", - "speak": "您的登录失败,请稍后再试。" - } - ], - "inputHint": "acceptingInput" - }, - "CancellingMessage": { - "replies": [ - { - "text": "当然,我们可以稍后再做。", - "speak": "当然,我们可以稍后再做。" - } - ], - "inputHint": "acceptingInput" - }, - "ActionEnded": { - "replies": [ - { - "text": "还有什么需要我的帮助吗?", - "speak": "还有什么需要我的帮助吗?" - }, - { - "text": "还有什么我可以帮你的吗?", - "speak": "还有什么我可以帮你的吗?" - }, - { - "text": "还有什么想要采取行动吗?", - "speak": "还有什么想要采取行动吗?" - }, - { - "text": "如果您需要我的帮助,请告诉我。", - "speak": "如果您需要我的帮助,请告诉我。" - }, - { - "text": "如果你需要我的帮助,我就在这里。", - "speak": "如果你需要我的帮助,我就在这里。" - } - ], - "inputHint": "acceptingInput" - }, - "ToDoErrorMessage": { - "replies": [ - { - "text": "对不起,看起来出了问题!", - "speak": "对不起,看起来出了问题!" - }, - { - "text": "发生错误,给我一些时间,稍后再试。", - "speak": "发生错误,给我一些时间,稍后再试。" - }, - { - "text": "出了点问题,对不起!", - "speak": "出了点问题,对不起!" - }, - { - "text": "我相信出了点问题。你稍后可以再试一次吗?", - "speak": "我相信出了点问题。你稍后可以再试一次吗?" - }, - { - "text": "抱歉,我现在找不到你想要的东西。请稍后再试。", - "speak": "抱歉,我现在找不到你想要的东西。请稍后再试。" - } - ], - "inputHint": "acceptingInput" - }, - "ToDoErrorMessage_BotProblem": { - "replies": [ - { - "text": "对不起,出了点问题。开发人员已经收到通知并且在解决这个问题。你很快就又可以正常使用这个功能了。", - "speak": "对不起,出了点问题。开发人员已经收到通知并且在解决这个问题。你很快就又可以正常使用这个功能了。" - } - ], - "inputHint": "acceptingInput" - }, - "SettingUpOneNoteMessage": { - "replies": [ - { - "text": "我注意到你还没有OneNote, 我正在为您创建,包含一个待办事项列表,一个购物列表以及一个杂货列表。", - "speak": "我注意到你还没有OneNote, 我正在为您创建,包含一个待办事项列表,一个购物列表以及一个杂货列表。" - } - ], - "inputHint": "ignoringInput" - }, - "AfterOneNoteSetupMessage": { - "replies": [ - { - "text": "设置完成,我已经给你发送带有OneNote链接的邮件,现在可以记录你的任务了。", - "speak": "设置完成,我已经给你发送带有OneNote链接的邮件,现在可以记录你的任务了。" - } - ], - "inputHint": "ignoringInput" - }, - "SettingUpOutlookMessage": { - "replies": [ - { - "text": "我注意到你还没有Outlook任务簿, 我正在为您创建,包含一个待办事项列表,一个购物列表以及一个杂货列表。", - "speak": "我注意到你还没有Outlook任务簿, 我正在为您创建,包含一个待办事项列表,一个购物列表以及一个杂货列表。" - } - ], - "inputHint": "ignoringInput" - }, - "AfterOutlookSetupMessage": { - "replies": [ - { - "text": "设置完成,我已经给你发送带有Outlook任务簿链接的邮件,现在可以记录你的任务了。", - "speak": "设置完成,我已经给你发送带有Outlook任务簿链接的邮件,现在可以记录你的任务了。" - } - ], - "inputHint": "ignoringInput" - }, - "ShowToDoTasks": { - "replies": [ - { - "text": "您的{listType}列表有{taskCount}个任务:", - "speak": "您的{listType}列表有{taskCount}个任务:" - } - ], - "inputHint": "ignoringInput" - }, - "AskToDoTaskIndex": { - "replies": [ - { - "text": "您想为这个操作选择哪个任务?", - "speak": "您想为这个操作选择哪个任务?" - } - ], - "inputHint": "expectingInput" - }, - "AskToDoContentText": { - "replies": [ - { - "text": "当然。您想加入什么到事项表?", - "speak": "当然。您想加入什么到待办事项表?" - }, - { - "text": "好的,您想加入什么到事项表?", - "speak": "好的,您想加入什么到事项表?" - }, - { - "text": "好,您想加入什么到事项表?", - "speak": "好,您想加入什么到事项表?" - }, - { - "text": "您想加入什么到事项表?", - "speak": "您想加入什么到事项表?" - } - ], - "inputHint": "expectingInput" - }, - "AfterToDoTaskAdded": { - "replies": [ - { - "text": "已经为您加入此任务。", - "speak": "已经为您加入此任务。" - } - ], - "inputHint": "acceptingInput" - }, - "NoTasksInList": { - "replies": [ - { - "text": "您的事项表是空的.", - "speak": "您的事项表是空的." - } - ], - "inputHint": "acceptingInput" - }, - "SwitchListType": { - "replies": [ - { - "text": "这看起来像是{listType}列表的任务。你想要把它加入到{listType}列表吗?", - "speak": "这看起来像是{listType}列表的任务。你想要把它加入到{listType}列表吗?" - } - ], - "inputHint": "expectingInput" - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/MainDialog.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/MainDialog.cs deleted file mode 100644 index 71da10343a..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/MainDialog.cs +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Luis; -using Microsoft.Bot.Builder; -using Microsoft.Bot.Builder.Dialogs; -using Microsoft.Bot.Schema; -using Microsoft.Bot.Builder.Solutions.Dialogs; -using Microsoft.Bot.Builder.Solutions.Skills; -using FakeSkill.Dialogs.Sample; -using FakeSkill.Dialogs.Shared.DialogOptions; -using FakeSkill.ServiceClients; -using FakeSkill.Dialogs.Auth; -using Microsoft.Bot.Builder.Solutions.Responses; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Main.Resources; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Shared.Resources; - -namespace FakeSkill.Dialogs.Main -{ - public class MainDialog : RouterDialog - { - private bool _skillMode; - private SkillConfigurationBase _services; - private ResponseManager _responseManager; - private UserState _userState; - private ConversationState _conversationState; - private IServiceManager _serviceManager; - private IStatePropertyAccessor _conversationStateAccessor; - private IStatePropertyAccessor _userStateAccessor; - - public MainDialog( - SkillConfigurationBase services, - ResponseManager responseManager, - ConversationState conversationState, - UserState userState, - IBotTelemetryClient telemetryClient, - IServiceManager serviceManager, - bool skillMode) - : base(nameof(MainDialog), telemetryClient) - { - _skillMode = skillMode; - _services = services; - _responseManager = responseManager; - _conversationState = conversationState; - _userState = userState; - _serviceManager = serviceManager; - TelemetryClient = telemetryClient; - - // Initialize state accessor - _conversationStateAccessor = _conversationState.CreateProperty(nameof(SkillConversationState)); - _userStateAccessor = _userState.CreateProperty(nameof(SkillUserState)); - - // RegisterDialogs - RegisterDialogs(); - } - - protected override async Task OnStartAsync(DialogContext dc, CancellationToken cancellationToken = default(CancellationToken)) - { - if (!_skillMode) - { - // send a greeting if we're in local mode - await dc.Context.SendActivityAsync(_responseManager.GetResponse(MainResponses.WelcomeMessage)); - } - } - - protected override async Task RouteAsync(DialogContext dc, CancellationToken cancellationToken = default(CancellationToken)) - { - var state = await _conversationStateAccessor.GetAsync(dc.Context, () => new SkillConversationState()); - - // get current activity locale - var locale = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName; - var localeConfig = _services.LocaleConfigurations[locale]; - - // Get skill LUIS model from configuration - localeConfig.LuisServices.TryGetValue("FakeSkill", out var luisService); - - if (luisService == null) - { - throw new Exception("The specified LUIS Model could not be found in your Bot Services configuration."); - } - else - { - var skillOptions = new SkillTemplateDialogOptions - { - SkillMode = _skillMode, - }; - - var result = await luisService.RecognizeAsync(dc.Context, CancellationToken.None); - var intent = result?.TopIntent().intent; - - switch (intent) - { - case FakeSkillLU.Intent.Sample: - { - await dc.BeginDialogAsync(nameof(SampleDialog), skillOptions); - break; - } - - case FakeSkillLU.Intent.Auth: - { - await dc.BeginDialogAsync(nameof(AuthDialog), skillOptions); - break; - } - - case FakeSkillLU.Intent.None: - { - // No intent was identified, send confused message - await dc.Context.SendActivityAsync(_responseManager.GetResponse(SharedResponses.DidntUnderstandMessage)); - if (_skillMode) - { - await CompleteAsync(dc); - } - - break; - } - - default: - { - // intent was identified but not yet implemented - await dc.Context.SendActivityAsync(_responseManager.GetResponse(MainResponses.FeatureNotAvailable)); - if (_skillMode) - { - await CompleteAsync(dc); - } - - break; - } - } - } - } - - protected override async Task CompleteAsync(DialogContext dc, DialogTurnResult result = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (_skillMode) - { - var response = dc.Context.Activity.CreateReply(); - response.Type = ActivityTypes.EndOfConversation; - - await dc.Context.SendActivityAsync(response); - } - - // End active dialog - await dc.EndDialogAsync(result); - } - - protected override async Task OnEventAsync(DialogContext dc, CancellationToken cancellationToken = default(CancellationToken)) - { - switch (dc.Context.Activity.Name) - { - case Events.SkillBeginEvent: - { - var state = await _conversationStateAccessor.GetAsync(dc.Context, () => new SkillConversationState()); - - if (dc.Context.Activity.Value is Dictionary userData) - { - // Capture user data from event if needed - } - - break; - } - - case Events.TokenResponseEvent: - { - // Auth dialog completion - var result = await dc.ContinueDialogAsync(); - - // If the dialog completed when we sent the token, end the skill conversation - if (result.Status != DialogTurnStatus.Waiting) - { - var response = dc.Context.Activity.CreateReply(); - response.Type = ActivityTypes.EndOfConversation; - - await dc.Context.SendActivityAsync(response); - } - - break; - } - } - } - - protected override async Task OnInterruptDialogAsync(DialogContext dc, CancellationToken cancellationToken = default(CancellationToken)) - { - var result = InterruptionAction.NoAction; - - if (dc.Context.Activity.Type == ActivityTypes.Message) - { - // get current activity locale - var locale = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName; - var localeConfig = _services.LocaleConfigurations[locale]; - - // check general luis intent - localeConfig.LuisServices.TryGetValue("general", out var luisService); - - if (luisService == null) - { - throw new Exception("The specified LUIS Model could not be found in your Skill configuration."); - } - else - { - var luisResult = await luisService.RecognizeAsync(dc.Context, cancellationToken); - var topIntent = luisResult.TopIntent().intent; - - switch (topIntent) - { - case General.Intent.Cancel: - { - result = await OnCancel(dc); - break; - } - - case General.Intent.Help: - { - result = await OnHelp(dc); - break; - } - - case General.Intent.Logout: - { - result = await OnLogout(dc); - break; - } - } - } - } - - return result; - } - - private async Task OnCancel(DialogContext dc) - { - await dc.Context.SendActivityAsync(_responseManager.GetResponse(MainResponses.CancelMessage)); - await CompleteAsync(dc); - await dc.CancelAllDialogsAsync(); - return InterruptionAction.StartedDialog; - } - - private async Task OnHelp(DialogContext dc) - { - await dc.Context.SendActivityAsync(_responseManager.GetResponse(MainResponses.HelpMessage)); - return InterruptionAction.MessageSentToUser; - } - - private async Task OnLogout(DialogContext dc) - { - BotFrameworkAdapter adapter; - var supported = dc.Context.Adapter is BotFrameworkAdapter; - if (!supported) - { - throw new InvalidOperationException("OAuthPrompt.SignOutUser(): not supported by the current adapter"); - } - else - { - adapter = (BotFrameworkAdapter)dc.Context.Adapter; - } - - await dc.CancelAllDialogsAsync(); - - // Sign out user - var tokens = await adapter.GetTokenStatusAsync(dc.Context, dc.Context.Activity.From.Id); - foreach (var token in tokens) - { - await adapter.SignOutUserAsync(dc.Context, token.ConnectionName); - } - - await dc.Context.SendActivityAsync(_responseManager.GetResponse(MainResponses.LogOut)); - - return InterruptionAction.StartedDialog; - } - - private void RegisterDialogs() - { - AddDialog(new SampleDialog(_services, _responseManager, _conversationStateAccessor, _userStateAccessor, _serviceManager, TelemetryClient)); - AddDialog(new AuthDialog(_services, _responseManager, _conversationStateAccessor, _userStateAccessor, _serviceManager, TelemetryClient)); - } - - private class Events - { - public const string TokenResponseEvent = "tokens/response"; - public const string SkillBeginEvent = "skillBegin"; - } - } -} \ No newline at end of file diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.cs deleted file mode 100644 index 4f16503475..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.cs +++ /dev/null @@ -1,23 +0,0 @@ -// https://docs.microsoft.com/en-us/visualstudio/modeling/t4-include-directive?view=vs-2017 -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Microsoft.Bot.Builder.Solutions.Responses; - -namespace Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Main.Resources -{ - /// - /// Contains bot responses. - /// - public class MainResponses : IResponseIdCollection - { - // Generated accessors - public const string WelcomeMessage = "WelcomeMessage"; - public const string HelpMessage = "HelpMessage"; - public const string GreetingMessage = "GreetingMessage"; - public const string GoodbyeMessage = "GoodbyeMessage"; - public const string LogOut = "LogOut"; - public const string FeatureNotAvailable = "FeatureNotAvailable"; - public const string CancelMessage = "CancelMessage"; - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.de.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.de.json deleted file mode 100644 index 17af1139427447a1c8a5a4bc6798e4bfddfb9366..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4004 zcmds)%Wm5+5JhKQp#Pw1o#q3&b03KVw9TT6E`ltaRB?=`k|C){AIRVKJKCN*jBF_~ zkPz?#DF|B>$>9uV?wz6j{`qCk?U^OC)DEq(jMmu93Y*#o`ZaArKV$wCtCs77j3nlk zBcZin&BT~*`BP` zce`S*$6GeW&YV_8S=E<%3Kn&3JiX_!)R8f_Z}@%e{iXjWc1{x-TKpV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Z0F>s=Bqa6r#^$*>{(~z zK4G^7JF8Y4JE%()46UeU#X1WrMSN4S8dD{k+VAF}+f&=IsXOPo&fEuA4w4bi8I0*X z4&l|wOTe~ZE`HaYAr9dtwzrG!1AYr#U?OFxW|n|&vJtL0t6fCRm0fp*Q!tk>+?9O= z>mlxbJ$4tH$K7z+TFr>O94LktrkmKD-NiV8Z|XaZdSa8QWS2k*gALM7H({bSkn>FTq0!M)-T=jyTf a(3#XdNF7YfxX)TxxA(tP1M)T8?tcTLCLZYk diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.json deleted file mode 100644 index 2cb741b57f..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "WelcomeMessage": { - "replies": [ - { - "text": "[Enter your intro message here]", - "speak": "[Enter your intro message here]" - } - ], - "suggestedActions": [], - "inputHint": "acceptingInput" - }, - "HelpMessage": { - "replies": [ - { - "text": "[Enter your help message here]", - "speak": "[Enter your help message here]" - } - ], - "suggestedActions": [], - "inputHint": "acceptingInput" - }, - "GreetingMessage": { - "replies": [ - { - "text": "Hi!", - "speak": "Hi!" - }, - { - "text": "Hi there!", - "speak": "Hi there!" - }, - { - "text": "Hello!", - "speak": "Hello!" - } - ], - "inputHint": "acceptingInput" - }, - "GoodbyeMessage": { - "replies": [ - { - "text": "Goodbye!", - "speak": "Goodbye!" - } - ], - "inputHint": "acceptingInput" - }, - "LogOut": { - "replies": [ - { - "text": "Your sign out was successful.", - "speak": "Your sign out was successful." - }, - { - "text": "You have successfully signed out.", - "speak": "You have successfully signed out." - }, - { - "text": "You have been logged out.", - "speak": "You have been logged out." - } - ], - "inputHint": "acceptingInput" - }, - "FeatureNotAvailable": { - "replies": [ - { - "text": "This feature is not yet available in this skill. Please try asking something else.", - "speak": "This feature is not yet available in thiskill. Please try asking something else." - } - ], - "inputHint": "acceptingInput" - }, - "CancelMessage": { - "replies": [ - { - "text": "Ok, let's start over.", - "speak": "Ok, let's start over." - } - ], - "inputHint": "acceptingInput" - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.tt b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.tt deleted file mode 100644 index d636d96c8b..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.tt +++ /dev/null @@ -1,3 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ output extension=".cs" #> -<#@ include file="..\..\Shared\Resources\ResponseIdCollection.t4"#> diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.zh.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.zh.json deleted file mode 100644 index 647d005144..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Main/Resources/MainResponses.zh.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "WelcomeMessage": { - "replies": [ - { - "text": "[在此输入您的简介信息]", - "speak": "[在此输入您的简介信息]" - } - ], - "inputHint": "acceptingInput" - }, - "HelpMessage": { - "replies": [ - { - "text": "[在此处输入您的帮助信息]", - "speak": "[在此处输入您的帮助信息]" - } - ], - "suggestedActions": [], - "inputHint": "acceptingInput" - }, - "GreetingMessage": { - "replies": [ - { - "text": "嗨!", - "speak": "嗨!" - }, - { - "text": "我在这!", - "speak": "我在这!" - }, - { - "text": "你好!", - "speak": "你好!" - }, - { - "text": "您好!", - "speak": "您好!" - } - ], - "inputHint": "acceptingInput" - }, - "GoodbyeMessage": { - "replies": [ - { - "text": "再见!", - "speak": "再见!" - } - ], - "inputHint": "acceptingInput" - }, - "LogOut": { - "replies": [ - { - "text": "您已成功退出。", - "speak": "您已成功退出。" - }, - { - "text": "您已退出。", - "speak": "您已退出。" - } - ], - "inputHint": "acceptingInput" - }, - "FeatureNotAvailable": { - "replies": [ - { - "text": "此功能在此技能中尚不可用。", - "speak": "此功能在此技能中尚不可用。" - } - ], - "inputHint": "acceptingInput" - }, - "CancelMessage": { - "replies": [ - { - "text": "好的, 我们从头再来。", - "speak": "好的, 我们从头再来。" - } - ], - "inputHint": "acceptingInput" - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.cs deleted file mode 100644 index af90d5dd3d..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.cs +++ /dev/null @@ -1,18 +0,0 @@ -// https://docs.microsoft.com/en-us/visualstudio/modeling/t4-include-directive?view=vs-2017 -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Microsoft.Bot.Builder.Solutions.Responses; - -namespace Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Sample.Resources -{ - /// - /// Contains bot responses. - /// - public class SampleResponses : IResponseIdCollection - { - // Generated accessors - public const string MessagePrompt = "MessagePrompt"; - public const string MessageResponse = "MessageResponse"; - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.de.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.de.json deleted file mode 100644 index b878da9ab0367b87ed252a87826b2016df9b4b47..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20414 zcmeI4+in{-5QceOpzomiI>`g{rf?GnF%mZg;xs^uqELK_E1w`Kahk%F$Hcomrc^^h7~Fyw<0SICDIq z;Gw8_t83$Mqw6~w%jaSE6i(u-zP>%yH@lh-Rl_(N%0?QuAO48z-Guw$+2q=hcC;1l z)u`Rl_@nS%@3!Z4QRY%{F5Xlq{dJ1+t;mrpabX;uOt|CppNdBp;@>b{KM{{E#0^Gn z-QM#iyWiHW{C6~G7-#N@CnLT3k>A~F!)%R!=AmSFPts)lo_^4hH=>=-mwHF?qd1~3 zO=Qfa^oQ|dX)^lD$OFw`COU$~oW*&^`h=ccOOMc+ZyGhi=&NhRI;g8_MO}mI_BM;d zJCQqPBXA6>>V?Pp^hO*qD>BQ1XV@F>@C=E(*7$M!yBFTY(Id$MP8(O=KE3+M7IcnN&aX*i6sK8(H`Z+<%Q9KY+^armGg{E1!V zGydmHp5DCBK=Y6;lKx(!*6p!A&pph9H^;3YRdms?>j#ak;?#sl(Or1L7$WX* z_*=inGvZ<$sjip8Tq8gn?GbAm9eE)XhjoK0oTHBWm#-VomC5ucNYy-56{{Lb1!nK25tKPJOCPs|Ny(WHB;$Gg<_|)FDTm*cXK~Bu)*@!*7fG{xT{PbF4Wc{QKnd!f|Bl^p zzKu8XI5jJS{!LiqQj+{p`zK$87v~+vuvtCdh-3#n8`3TH6<*aRiLQEO7D2-xyx)`c4vd-6=}0HM?NoQ zaaCCBrh|#9yP0J>*r&%Y&qA#hiyc`tbr>nI zmASK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F-)=9mzDln>YJLT-V1LY=SH|=e<-r@u|NRvF-lR zoK*Ae^e5<1{S*om!3mSq01Z!Im7JMF4>jUJmUXUU?No}ZV}~vGz3;sVejr5stJ993 z_$En=C#!Iz)OuyPK>xJ8PZ9WF{<94oS;yLCx$_~rDXk-=)~jHl!B zNKUMcD52{%L0ehwMo({+#tz56>mA&WeNy`f@Bb2s>_j@{y7k3#qWjoCZ5czTl)zgo zJLDI6HXCAKo79!&FsKm@L|ZU9|)R2@y{=kaqttDe;4U&>HW=Tth9 z6U~-+2d$|;KJAv-L}Xj7-#WxMGR$i451!7X7CYX}lT~{Fwxn&buL_^Z87Vn-@RZCo zue06i=OMG0*VkUX%P1yNuoCq-e0J%~3>w&*G%9$Sywi4d^S~R|e`}@-W6k}NTHkOeS0WS-^sdlW6c<+e|_MWSCj;%NT Vm07LMfpjFtVit{c%x}H9{{z|43OxV- diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.it.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.it.json deleted file mode 100644 index e8f6e499a0828a73ca969ba0e786a2f395e4099a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19050 zcmeI4&2C#o6vt2|fMw!+v-ZPQ%aPK+li#I0%C< z3vc!4hc7jwnrrjV!zi4E<1o>y&-wo5dd%Uk{ww?COurlH>Tj>F%-W}6sz*=XaNU_6 z({Q0{bA^j*N_I8lGLBzqe5AEU;Ut+kjbq2*^Xu=XVHmIZAyPThbq>NWaqTPZs2?6Q zsO@XcD7@FR?YS$;Tq@4Rs~V+0%u(JKpQhT^rRaVV-&gcc!Z>pFJdTgU)0>(7n`>Sr z*X!TN|FI--F8-Z|=iR9G7pX~gp=`y)N0EfcLh)Y=aucXZ<<9Ez@iJ`JU{ zBfb8l-47&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b~ev*28k z!#}#0a)j;iqpB7%JN0Jm^*}7YSrhDnwp0VmKcyo%ISu!?mjP4jbG0O@^iRH(a(^_zq=P`@1+@*^QZa?NY^q`Qr zc;vIX2uQ6ueWCtgy(;8M_(y6c7W)i!wDl;p`@XWPHYK_a9&l9CMRjr{%qQ- zFdzs}K~;CPt`<(gb8x|?=_t!J>z$#i>rd@}zAwje={M3BvJO9WGqkmcS2?kCGpm>7 zP+gw%IFOGK0}M}4ALNtQPwdPnwJ@uBFtUix#!)H>i*+!EuXl;&veMWSuc`9bSu{Ka z^9|yO4z(Y?$>G$p*DJdV*L$cPi)znAs56;Aa&02Q;K8k~<+UdB`hQM7X{h*iYhGSPWp=O` zNm*QP`l{u3mv&=Y9zXB7{G>4t2fL+jpTe@7{!KbbWeyFtyNS%BH&0ud$hmu;bvLPR zN+=!4!5FJmpVJeGU3nizYusta75zT6`UzcMzG=042d(zi?0m;Y=q%tAiHa|@cxBD+ zJHh(s6Y^RKx=4ipUs-jR=47a4S4}0iK0bJvkxhHWU2%)b zka-vI!?=@f&0SGo_qyT--1@5%cI(-(4Ba}wR=vw}{gqPrtnd47qX(Hx;#stxLvykK zhjQvr>#b6D$1kGA($`K+#c;OY6JY01X4#9X-18M0M__h6?A-fb$s--d=JBgb8q0FK z>D95N6aA4h5pAun0pH3=MAb*>otuZ6$?28dn@^1yZ@~$JW#yhr%++mpy)~QMNJny_j%T4c^*-zPsP{61aH#`=d7taC?f>DB(;w>* z$UIKHhr>?kyce3>p|U8OU)7f9`#5_3~8gM z&{ap$ZsnG7RP%H6^`4_?uJ&IXO>NH*MLLpWjrlz(J3@b0A|C9q9(ea{bq3RmjHb86 zBI~i>oSaM;EnPkiS(X60u!!dWX@xt>9UbIoa@TaG+OR(2+}}#HT5px+j?3 Jaecct|6g@XJDval diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.json deleted file mode 100644 index 71c9a251c5..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "MessagePrompt": { - "replies": [ - { - "text": "Please type your message.", - "speak": "Please type your message." - }, - { - "text": "Try saying something for this dialog.", - "speak": "Try saying something for this dialog." - } - ], - "inputHint": "expectingInput" - }, - "MessageResponse": { - "replies": [ - { - "text": "You said: {Message}", - "speak": "You said: {Message}" - } - ], - "inputHint": "acceptingInput" - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.tt b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.tt deleted file mode 100644 index d636d96c8b..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.tt +++ /dev/null @@ -1,3 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ output extension=".cs" #> -<#@ include file="..\..\Shared\Resources\ResponseIdCollection.t4"#> diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.zh.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.zh.json deleted file mode 100644 index 44c91b5ec1..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/Resources/SampleResponses.zh.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "DidntUnderstandMessage": { - "replies": [ - { - "text": "对不起,没有明白你的意思。", - "speak": "对不起,没有明白你的意思。" - }, - { - "text": "我没有明白你的意思,你能以不同的方式尝试吗?", - "speak": "我没有明白你的意思,你能以不同的方式尝试吗?" - }, - { - "text": "你能以不同的方式说出来吗?", - "speak": "你能以不同的方式说出来吗?" - }, - { - "text": "你能再试一次问我,我没听懂你的意思。", - "speak": "你能再试一次问我,我没听懂你的意思。" - } - ], - "inputHint": "acceptingInput" - }, - "NoAuth": { - "replies": [ - { - "text": "请登录,以便我采取进一步行动。", - "speak": "请登录,以便我采取进一步行动。" - } - ], - "inputHint": "expectingInput" - }, - "AuthFailed": { - "replies": [ - { - "text": "您的登录失败,请稍后再试。", - "speak": "您的登录失败,请稍后再试。" - } - ], - "inputHint": "acceptingInput" - }, - "CancellingMessage": { - "replies": [ - { - "text": "当然,我们可以稍后再做。", - "speak": "当然,我们可以稍后再做。" - } - ], - "inputHint": "acceptingInput" - }, - "ActionEnded": { - "replies": [ - { - "text": "还有什么需要我的帮助吗?", - "speak": "还有什么需要我的帮助吗?" - }, - { - "text": "还有什么我可以帮你的吗?", - "speak": "还有什么我可以帮你的吗?" - }, - { - "text": "还有什么想要采取行动吗?", - "speak": "还有什么想要采取行动吗?" - }, - { - "text": "如果您需要我的帮助,请告诉我。", - "speak": "如果您需要我的帮助,请告诉我。" - }, - { - "text": "如果你需要我的帮助,我就在这里。", - "speak": "如果你需要我的帮助,我就在这里。" - } - ], - "inputHint": "acceptingInput" - }, - "ToDoErrorMessage": { - "replies": [ - { - "text": "对不起,看起来出了问题!", - "speak": "对不起,看起来出了问题!" - }, - { - "text": "发生错误,给我一些时间,稍后再试。", - "speak": "发生错误,给我一些时间,稍后再试。" - }, - { - "text": "出了点问题,对不起!", - "speak": "出了点问题,对不起!" - }, - { - "text": "我相信出了点问题。你稍后可以再试一次吗?", - "speak": "我相信出了点问题。你稍后可以再试一次吗?" - }, - { - "text": "抱歉,我现在找不到你想要的东西。请稍后再试。", - "speak": "抱歉,我现在找不到你想要的东西。请稍后再试。" - } - ], - "inputHint": "acceptingInput" - }, - "ToDoErrorMessage_BotProblem": { - "replies": [ - { - "text": "对不起,出了点问题。开发人员已经收到通知并且在解决这个问题。你很快就又可以正常使用这个功能了。", - "speak": "对不起,出了点问题。开发人员已经收到通知并且在解决这个问题。你很快就又可以正常使用这个功能了。" - } - ], - "inputHint": "acceptingInput" - }, - "SettingUpOneNoteMessage": { - "replies": [ - { - "text": "我注意到你还没有OneNote, 我正在为您创建,包含一个待办事项列表,一个购物列表以及一个杂货列表。", - "speak": "我注意到你还没有OneNote, 我正在为您创建,包含一个待办事项列表,一个购物列表以及一个杂货列表。" - } - ], - "inputHint": "ignoringInput" - }, - "AfterOneNoteSetupMessage": { - "replies": [ - { - "text": "设置完成,我已经给你发送带有OneNote链接的邮件,现在可以记录你的任务了。", - "speak": "设置完成,我已经给你发送带有OneNote链接的邮件,现在可以记录你的任务了。" - } - ], - "inputHint": "ignoringInput" - }, - "SettingUpOutlookMessage": { - "replies": [ - { - "text": "我注意到你还没有Outlook任务簿, 我正在为您创建,包含一个待办事项列表,一个购物列表以及一个杂货列表。", - "speak": "我注意到你还没有Outlook任务簿, 我正在为您创建,包含一个待办事项列表,一个购物列表以及一个杂货列表。" - } - ], - "inputHint": "ignoringInput" - }, - "AfterOutlookSetupMessage": { - "replies": [ - { - "text": "设置完成,我已经给你发送带有Outlook任务簿链接的邮件,现在可以记录你的任务了。", - "speak": "设置完成,我已经给你发送带有Outlook任务簿链接的邮件,现在可以记录你的任务了。" - } - ], - "inputHint": "ignoringInput" - }, - "ShowToDoTasks": { - "replies": [ - { - "text": "您的{listType}列表有{taskCount}个任务:", - "speak": "您的{listType}列表有{taskCount}个任务:" - } - ], - "inputHint": "ignoringInput" - }, - "AskToDoTaskIndex": { - "replies": [ - { - "text": "您想为这个操作选择哪个任务?", - "speak": "您想为这个操作选择哪个任务?" - } - ], - "inputHint": "expectingInput" - }, - "AskToDoContentText": { - "replies": [ - { - "text": "当然。您想加入什么到事项表?", - "speak": "当然。您想加入什么到待办事项表?" - }, - { - "text": "好的,您想加入什么到事项表?", - "speak": "好的,您想加入什么到事项表?" - }, - { - "text": "好,您想加入什么到事项表?", - "speak": "好,您想加入什么到事项表?" - }, - { - "text": "您想加入什么到事项表?", - "speak": "您想加入什么到事项表?" - } - ], - "inputHint": "expectingInput" - }, - "AfterToDoTaskAdded": { - "replies": [ - { - "text": "已经为您加入此任务。", - "speak": "已经为您加入此任务。" - } - ], - "inputHint": "acceptingInput" - }, - "NoTasksInList": { - "replies": [ - { - "text": "您的事项表是空的.", - "speak": "您的事项表是空的." - } - ], - "inputHint": "acceptingInput" - }, - "SwitchListType": { - "replies": [ - { - "text": "这看起来像是{listType}列表的任务。你想要把它加入到{listType}列表吗?", - "speak": "这看起来像是{listType}列表的任务。你想要把它加入到{listType}列表吗?" - } - ], - "inputHint": "expectingInput" - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/SampleDialog.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/SampleDialog.cs deleted file mode 100644 index 4da02430b8..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Sample/SampleDialog.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.Collections.Specialized; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Bot.Builder; -using Microsoft.Bot.Builder.Dialogs; -using Microsoft.Bot.Builder.Solutions.Skills; -using FakeSkill.Dialogs.Shared; -using FakeSkill.ServiceClients; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Sample.Resources; -using Microsoft.Bot.Builder.Solutions.Responses; - -namespace FakeSkill.Dialogs.Sample -{ - public class SampleDialog : SkillTemplateDialog - { - public SampleDialog( - SkillConfigurationBase services, - ResponseManager responseManager, - IStatePropertyAccessor conversationStateAccessor, - IStatePropertyAccessor userStateAccessor, - IServiceManager serviceManager, - IBotTelemetryClient telemetryClient) - : base(nameof(SampleDialog), services, responseManager, conversationStateAccessor, userStateAccessor, serviceManager, telemetryClient) - { - var sample = new WaterfallStep[] - { - PromptForMessage, - PrintMessage, - End, - }; - - AddDialog(new WaterfallDialog(nameof(SampleDialog), sample)); - AddDialog(new TextPrompt(DialogIds.MessagePrompt)); - } - - private async Task PromptForMessage(WaterfallStepContext stepContext, CancellationToken cancellationToken) - { - var prompt = ResponseManager.GetResponse(SampleResponses.MessagePrompt); - return await stepContext.PromptAsync(DialogIds.MessagePrompt, new PromptOptions { Prompt = prompt }); - } - - private async Task PrintMessage(WaterfallStepContext stepContext, CancellationToken cancellationToken) - { - var tokens = new StringDictionary - { - { "Message", stepContext.Result.ToString() }, - }; - - var response = ResponseManager.GetResponse(SampleResponses.MessageResponse, tokens); - await stepContext.Context.SendActivityAsync(response); - - return await stepContext.NextAsync(); - } - - private Task End(WaterfallStepContext stepContext, CancellationToken cancellationToken) - { - return stepContext.EndDialogAsync(); - } - - private class DialogIds - { - public const string MessagePrompt = "messagePrompt"; - } - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/DialogOptions/SkillDialogOptions.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/DialogOptions/SkillDialogOptions.cs deleted file mode 100644 index 252e6282b6..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/DialogOptions/SkillDialogOptions.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace FakeSkill.Dialogs.Shared.DialogOptions -{ - public class SkillTemplateDialogOptions - { - public bool SkillMode { get; set; } - } -} \ No newline at end of file diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/FakeSkillDialog.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/FakeSkillDialog.cs deleted file mode 100644 index 6880ea60b7..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/FakeSkillDialog.cs +++ /dev/null @@ -1,202 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Bot.Builder; -using Microsoft.Bot.Builder.Dialogs; -using Microsoft.Bot.Schema; -using Microsoft.Bot.Builder.Solutions.Authentication; -using Microsoft.Bot.Builder.Solutions.Skills; -using Microsoft.Bot.Builder.Solutions.Util; -using Newtonsoft.Json.Linq; -using FakeSkill.Dialogs.Shared.DialogOptions; -using FakeSkill.ServiceClients; -using Microsoft.Bot.Builder.Solutions.Responses; -using Microsoft.Bot.Builder.Solutions.Tests; -using Microsoft.Bot.Builder.Solutions.Telemetry; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Shared.Resources; - -namespace FakeSkill.Dialogs.Shared -{ - public class SkillTemplateDialog : ComponentDialog - { - public SkillTemplateDialog( - string dialogId, - SkillConfigurationBase services, - ResponseManager responseManager, - IStatePropertyAccessor conversationStateAccessor, - IStatePropertyAccessor userStateAccessor, - IServiceManager serviceManager, - IBotTelemetryClient telemetryClient) - : base(dialogId) - { - Services = services; - ResponseManager = responseManager; - ConversationStateAccessor = conversationStateAccessor; - UserStateAccessor = userStateAccessor; - ServiceManager = serviceManager; - TelemetryClient = telemetryClient; - - // NOTE: Uncomment the following if your skill requires authentication - //if (!Services.AuthenticationConnections.Any()) - //{ - // throw new Exception("You must configure an authentication connection in your bot file before using this component."); - //} - - //AddDialog(new EventPrompt(DialogIds.SkillModeAuth, "tokens/response", TokenResponseValidator)); - //AddDialog(new MultiProviderAuthDialog(services)); - } - - protected SkillConfigurationBase Services { get; set; } - - protected IStatePropertyAccessor ConversationStateAccessor { get; set; } - - protected IStatePropertyAccessor UserStateAccessor { get; set; } - - protected IServiceManager ServiceManager { get; set; } - - protected ResponseManager ResponseManager { get; set; } - - protected override async Task OnBeginDialogAsync(DialogContext dc, object options, CancellationToken cancellationToken = default(CancellationToken)) - { - await DigestLuisResult(dc); - return await base.OnBeginDialogAsync(dc, options, cancellationToken); - } - - protected override async Task OnContinueDialogAsync(DialogContext dc, CancellationToken cancellationToken = default(CancellationToken)) - { - await DigestLuisResult(dc); - return await base.OnContinueDialogAsync(dc, cancellationToken); - } - - // Shared steps - protected async Task GetAuthToken(WaterfallStepContext sc, CancellationToken cancellationToken = default(CancellationToken)) - { - try - { - var skillOptions = (SkillTemplateDialogOptions)sc.Options; - - // If in Skill mode we ask the calling Bot for the token - if (skillOptions != null && skillOptions.SkillMode) - { - // We trigger a Token Request from the Parent Bot by sending a "TokenRequest" event back and then waiting for a "TokenResponse" - // TODO Error handling - if we get a new activity that isn't an event - var response = sc.Context.Activity.CreateReply(); - response.Type = ActivityTypes.Event; - response.Name = "tokens/request"; - - // Send the tokens/request Event - await sc.Context.SendActivityAsync(response); - - // Wait for the tokens/response event - return await sc.PromptAsync(DialogIds.SkillModeAuth, new PromptOptions()); - } - else - { - return await sc.PromptAsync(nameof(MultiProviderAuthDialog), new PromptOptions() { RetryPrompt = ResponseManager.GetResponse(SharedResponses.NoAuth) }); - } - } - catch (Exception ex) - { - await HandleDialogExceptions(sc, ex); - return new DialogTurnResult(DialogTurnStatus.Cancelled, CommonUtil.DialogTurnResultCancelAllDialogs); - } - } - - protected async Task AfterGetAuthToken(WaterfallStepContext sc, CancellationToken cancellationToken = default(CancellationToken)) - { - try - { - // When the user authenticates interactively we pass on the tokens/Response event which surfaces as a JObject - // When the token is cached we get a TokenResponse object. - var skillOptions = (SkillTemplateDialogOptions)sc.Options; - ProviderTokenResponse providerTokenResponse; - if (skillOptions != null && skillOptions.SkillMode) - { - var resultType = sc.Context.Activity.Value.GetType(); - if (resultType == typeof(ProviderTokenResponse)) - { - providerTokenResponse = sc.Context.Activity.Value as ProviderTokenResponse; - } - else - { - var tokenResponseObject = sc.Context.Activity.Value as JObject; - providerTokenResponse = tokenResponseObject?.ToObject(); - } - } - else - { - providerTokenResponse = sc.Result as ProviderTokenResponse; - } - - if (providerTokenResponse != null) - { - var state = await ConversationStateAccessor.GetAsync(sc.Context); - state.Token = providerTokenResponse.TokenResponse.Token; - } - - return await sc.NextAsync(); - } - catch (Exception ex) - { - await HandleDialogExceptions(sc, ex); - return new DialogTurnResult(DialogTurnStatus.Cancelled, CommonUtil.DialogTurnResultCancelAllDialogs); - } - } - - // Validators - protected Task TokenResponseValidator(PromptValidatorContext pc, CancellationToken cancellationToken) - { - var activity = pc.Recognized.Value; - if (activity != null && activity.Type == ActivityTypes.Event) - { - return Task.FromResult(true); - } - else - { - return Task.FromResult(false); - } - } - - protected Task AuthPromptValidator(PromptValidatorContext promptContext, CancellationToken cancellationToken) - { - var token = promptContext.Recognized.Value; - if (token != null) - { - return Task.FromResult(true); - } - else - { - return Task.FromResult(false); - } - } - - // Helpers - protected Task DigestLuisResult(DialogContext dc) - { - return Task.CompletedTask; - } - - // This method is called by any waterfall step that throws an exception to ensure consistency - protected async Task HandleDialogExceptions(WaterfallStepContext sc, Exception ex) - { - // send trace back to emulator - var trace = new Activity(type: ActivityTypes.Trace, text: $"DialogException: {ex.Message}, StackTrace: {ex.StackTrace}"); - await sc.Context.SendActivityAsync(trace); - - // log exception - TelemetryClient.TrackExceptionEx(ex, sc.Context.Activity, sc.ActiveDialog?.Id); - - // send error message to bot user - await sc.Context.SendActivityAsync(ResponseManager.GetResponse(SharedResponses.ErrorMessage)); - - // clear state - var state = await ConversationStateAccessor.GetAsync(sc.Context); - state.Clear(); - } - - private class DialogIds - { - public const string SkillModeAuth = "SkillAuth"; - } - } -} \ No newline at end of file diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/FakeSkillLU.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/FakeSkillLU.cs deleted file mode 100644 index 68af3101e8..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/FakeSkillLU.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// Tool github: https://github.com/microsoft/botbuilder-tools -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// -using Newtonsoft.Json; -using System.Collections.Generic; -namespace Luis -{ - public class FakeSkillLU : Microsoft.Bot.Builder.IRecognizerConvert - { - public string Text; - public string AlteredText; - public enum Intent - { - Sample, - Auth, - None - }; - public Dictionary Intents; - - public class _Entities - { - // Instance - public class _Instance - { - } - [JsonProperty("$instance")] - public _Instance _instance; - } - public _Entities Entities; - - [JsonExtensionData(ReadData = true, WriteData = true)] - public IDictionary Properties { get; set; } - - public void Convert(dynamic result) - { - var app = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(result)); - Text = app.Text; - AlteredText = app.AlteredText; - Intents = app.Intents; - Entities = app.Entities; - Properties = app.Properties; - } - - public (Intent intent, double score) TopIntent() - { - Intent maxIntent = Intent.None; - var max = 0.0; - foreach (var entry in Intents) - { - if (entry.Value.Score > max) - { - maxIntent = entry.Key; - max = entry.Value.Score.Value; - } - } - return (maxIntent, max); - } - } -} \ No newline at end of file diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/ResponseIdCollection.t4 b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/ResponseIdCollection.t4 deleted file mode 100644 index d6c0d7cc3e..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/ResponseIdCollection.t4 +++ /dev/null @@ -1,31 +0,0 @@ -<#@ assembly name="Newtonsoft.Json.dll" #> -<# - var className = System.IO.Path.GetFileNameWithoutExtension(Host.TemplateFile); - var namespaceName = System.Runtime.Remoting.Messaging.CallContext.LogicalGetData("NamespaceHint"); - string myFile = System.IO.File.ReadAllText(this.Host.ResolvePath(className + ".json")); - var json = Newtonsoft.Json.JsonConvert.DeserializeObject>(myFile); - var responses = string.Empty; - var cards = string.Empty; -#> -// https://docs.microsoft.com/en-us/visualstudio/modeling/t4-include-directive?view=vs-2017 -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Microsoft.Bot.Builder.Solutions.Responses; - -namespace <#= namespaceName #> -{ - /// - /// Contains bot responses. - /// - public class <#= className #> : IResponseIdCollection - { - // Generated accessors -<# -// This code runs in the text json: -foreach (var propertyName in json) { -#> - public const string <#= propertyName.Key.Substring(0, 1).ToUpperInvariant() + propertyName.Key.Substring(1) #> = "<#= propertyName.Key #>"; -<# } #> - } -} \ No newline at end of file diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.cs deleted file mode 100644 index 4aff239014..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.cs +++ /dev/null @@ -1,22 +0,0 @@ -// https://docs.microsoft.com/en-us/visualstudio/modeling/t4-include-directive?view=vs-2017 -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Microsoft.Bot.Builder.Solutions.Responses; - -namespace Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Shared.Resources -{ - /// - /// Contains bot responses. - /// - public class SharedResponses : IResponseIdCollection - { - // Generated accessors - public const string DidntUnderstandMessage = "DidntUnderstandMessage"; - public const string CancellingMessage = "CancellingMessage"; - public const string NoAuth = "NoAuth"; - public const string AuthFailed = "AuthFailed"; - public const string ActionEnded = "ActionEnded"; - public const string ErrorMessage = "ErrorMessage"; - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.de.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.de.json deleted file mode 100644 index 99ff833acf0bfe0814c6969f70d9b58f7812a4ea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11500 zcmdT~O>f&q5Z!Zu{0Eiiz&{|DqD>scNZb|(nnQvfWJ{JEOSB-dcIzO&H5dPeo{A># z&2Y3!kx9JdQleouG545Z zwyFCY-+Hcn?apLlxP5Hc@BI-z6m%}|O+2SSh-f^=uX7+Y1tyB`nP653M#Lc(yid@- z5L`y?T6(V`3nHzkz81v2GAh9lWi&|PFviJjF_0s)|8S~a!+ob(JMQidyJ6#_VF2EmTq6L_PEI|&sa1)XB zM7W%6eo->Vdps@Nt&GUaR*okB%)#`^LYEjv=~B|apx3?`>tUX;F72@8&n+*M0p}e4 zoYH(DzrEiaLwcu>%@WVpYvztNeY1`44gFf?ewLZe;hDx5L#>#Uez@xEGVxF;V~}T9 zZwk$^9Z;vZ?=yUE<=F~*<0;6w>iei;^m6=;*ShYWaVUHC(o7SrSUhnKEjR(Tj8!x$ zwCLjwvRD9j^?=3`8rR(7*&JSRCb7&A_~4rTkGmw4nHq@9D)~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G{&12Esw+iyK2Q&M=k}oW~1d@L4DtY1)aFbnQcv?;#S)g)RXN>kJ*L_&HWN5!p1Imx{d7E^6>F#^6!P5=X)G6b zrnW^nEyYTv^|pG+>zavM+Rn4VKGXx2Qv;aIO4W`PD~b23RF=qBs%T8T_e6Ur+uH_< zB0^wewhJybMv7f5SE^XUi|5_xvfF6{u_x?Ns2G7AZ85r`!oEyob4a(|2-_(LbvwA6 z3eBD@np2Qd>4EEsG6bvOjMdU@*_Q7{d_HOOYG4*`|F6PD^nn|&<)M%a7{~Q$_yoS- z{AiI_T=AB%(Ij)F%aIqg_p%{!D&x-J>rG`2{oCV)RmoRJIc`abxtzmt3cM%Q1lK0@ z_f1*mK)+xYfS2>DRaCS#H9J-tPN>aOLT!?|GBUzW*pJmILp+%8#5LcHvA!0Mpm)nf zy%rr`dbE~>M(V725wV;c8@TW+YL#owipaaz#|BoozYbDWwZV=kXE_^tB&?0x!cG}e zGPc!8m>22iw;T$N2$k*)Tm8{@Q_f(a^3LeKJsX>Q)n3LA{BsK-X{4?i8X3{GI z2Vsw;&s(XqgN5b&)A*$B0P@UMM<8xVi7fM->{=Wmm)!DpLx#DWecdZ*<Px# diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.fr.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.fr.json deleted file mode 100644 index d61e51ca73307035e8d0cbe123277ac81c843dd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11096 zcmdT~%We}f6uoOC{vphUP3Z@)sVFT1#G?r42Cl(Sx#|(*IY|+y@4Ke{Pxh=NB<_qe1s=$<>aG83GS=PIlgrktC7XxZZWwk zkZykTK4XqVri$58Gn{n^h&;x5*I?I1OAC1R4VG1daR<0qO<&;b5`C!CKKc;76n!eP z9e~`j<%o;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soft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.it.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.it.json deleted file mode 100644 index fdf5a5074b11f42aa0f42018adc78f8865a2efb7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10412 zcmd6t%Wl&^6ozMw#5)*o*q}ZDn+kCeEU1bq*dP{elBN-D6Vi(isPD(4ux7^w_`f-s z+K$uKgC}tmB~Hd;&+&h5|2dPtf4;ki?t#nn%H2yh*K4ZxTQ_p&dKGT0Z@GJ_^W{vN zJ=d9;J8=^~*XDe@xf^qM)vpSpx$ZsFb%p!9xO=WOCz?OhC+8+QH_(hH8avnV)E!E$ zLca#?Sidv(#a-(6iGEMLq?!Av(ZZeS9)-KmC|7cv`_D&O=}ALAB+7Mu0lhp(D70{cjyF{0REk zi9l}Ma->D=U8D_Rji*ASX{RyPm3Gy%h#bfUy8GIW5ZV{EQ;$_UE8C5-vOc9ui}>oe zm&sqJ-e+ez5{rpvh48#wcqYDDDArk|p2|zX9N*96`-ME3$j7WY{#`wMTjXtOp*r$u zDVpX&?o6=_^j`b#Wwa;LkZWc-$E>k?b2B%;$r#o6oV#cKPRH(**U5>l9xk#+J!a=# z2PyNUtvr&1NK1tOrX#k3u7lN}^GjLHKu02ZTkD94_3M?SL_ST1-18V2n;?SM5i;)@ zYCKp2o`wIkMXsw~^(9}`Ye2ec=K=Y;O^4A{EbfgMS*G_?UW6}|76~_5#@w(q{sH4V z)peFzxsLon6pOLRb*rSJ?rM4e-= zKVlLr(l~g@&(S53@=E7S%jRG0d3oAZs~YTX`N4mi7{D5j^z3ut)y&71qs>>a|Dnea z-fc{t%pcy{%eYF00hmwySRq!k!s}WP+x=k{t)yBTCz3`|Kf58+D6zWdk-&RA% zSYX@xrG1Lvby&w(Qiq%yET*(3G7J&idM{WAvn`U7f9~_fn8>wRsnQ}^xA=MnJQT{X z^B64J-Y@M_1Pxd;Zdya?IFV|-v?!FFi~IA@srUa?taVquahDcLUIeOiAYpcK-M0QE zZ6aSCSvM~R-%yEfrb`_xb~$n`SB=JHCSoaNbTvH_NwF)_x7C=La`uV00V*V-Et#dP z?BlGWPZ_J)@6M^)KZ!-AlDmXm0? zd%(Snk>Dxl+IFF=(-l)s8Y{lvo7?Ls%@eFgQ>a%FZ<2|U%R#I^gmbBp$4)_ z8&4VcvOoS@64*{Q^?b-^W!IEFpZTH}&}|R5`$|>)bY}tg$%9TNeitO{Vbencp_q!R z+bU_FcyAFstRrI?$Xkq^q;CINHaR_f( zuC%Du{Rwmo8@iTYX1(y+5o8XQ`TsuLZOtYc)sdL26Zlr#{<7sLPU% -<#@ output extension=".cs" #> -<#@ include file="..\..\Shared\Resources\ResponseIdCollection.t4"#> diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.zh.json b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.zh.json deleted file mode 100644 index 44c91b5ec1..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/Dialogs/Shared/Resources/SharedResponses.zh.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "DidntUnderstandMessage": { - "replies": [ - { - "text": "对不起,没有明白你的意思。", - "speak": "对不起,没有明白你的意思。" - }, - { - "text": "我没有明白你的意思,你能以不同的方式尝试吗?", - "speak": "我没有明白你的意思,你能以不同的方式尝试吗?" - }, - { - "text": "你能以不同的方式说出来吗?", - "speak": "你能以不同的方式说出来吗?" - }, - { - "text": "你能再试一次问我,我没听懂你的意思。", - "speak": "你能再试一次问我,我没听懂你的意思。" - } - ], - "inputHint": "acceptingInput" - }, - "NoAuth": { - "replies": [ - { - "text": "请登录,以便我采取进一步行动。", - "speak": "请登录,以便我采取进一步行动。" - } - ], - "inputHint": "expectingInput" - }, - "AuthFailed": { - "replies": [ - { - "text": "您的登录失败,请稍后再试。", - "speak": "您的登录失败,请稍后再试。" - } - ], - "inputHint": "acceptingInput" - }, - "CancellingMessage": { - "replies": [ - { - "text": "当然,我们可以稍后再做。", - "speak": "当然,我们可以稍后再做。" - } - ], - "inputHint": "acceptingInput" - }, - "ActionEnded": { - "replies": [ - { - "text": "还有什么需要我的帮助吗?", - "speak": "还有什么需要我的帮助吗?" - }, - { - "text": "还有什么我可以帮你的吗?", - "speak": "还有什么我可以帮你的吗?" - }, - { - "text": "还有什么想要采取行动吗?", - "speak": "还有什么想要采取行动吗?" - }, - { - "text": "如果您需要我的帮助,请告诉我。", - "speak": "如果您需要我的帮助,请告诉我。" - }, - { - "text": "如果你需要我的帮助,我就在这里。", - "speak": "如果你需要我的帮助,我就在这里。" - } - ], - "inputHint": "acceptingInput" - }, - "ToDoErrorMessage": { - "replies": [ - { - "text": "对不起,看起来出了问题!", - "speak": "对不起,看起来出了问题!" - }, - { - "text": "发生错误,给我一些时间,稍后再试。", - "speak": "发生错误,给我一些时间,稍后再试。" - }, - { - "text": "出了点问题,对不起!", - "speak": "出了点问题,对不起!" - }, - { - "text": "我相信出了点问题。你稍后可以再试一次吗?", - "speak": "我相信出了点问题。你稍后可以再试一次吗?" - }, - { - "text": "抱歉,我现在找不到你想要的东西。请稍后再试。", - "speak": "抱歉,我现在找不到你想要的东西。请稍后再试。" - } - ], - "inputHint": "acceptingInput" - }, - "ToDoErrorMessage_BotProblem": { - "replies": [ - { - "text": "对不起,出了点问题。开发人员已经收到通知并且在解决这个问题。你很快就又可以正常使用这个功能了。", - "speak": "对不起,出了点问题。开发人员已经收到通知并且在解决这个问题。你很快就又可以正常使用这个功能了。" - } - ], - "inputHint": "acceptingInput" - }, - "SettingUpOneNoteMessage": { - "replies": [ - { - "text": "我注意到你还没有OneNote, 我正在为您创建,包含一个待办事项列表,一个购物列表以及一个杂货列表。", - "speak": "我注意到你还没有OneNote, 我正在为您创建,包含一个待办事项列表,一个购物列表以及一个杂货列表。" - } - ], - "inputHint": "ignoringInput" - }, - "AfterOneNoteSetupMessage": { - "replies": [ - { - "text": "设置完成,我已经给你发送带有OneNote链接的邮件,现在可以记录你的任务了。", - "speak": "设置完成,我已经给你发送带有OneNote链接的邮件,现在可以记录你的任务了。" - } - ], - "inputHint": "ignoringInput" - }, - "SettingUpOutlookMessage": { - "replies": [ - { - "text": "我注意到你还没有Outlook任务簿, 我正在为您创建,包含一个待办事项列表,一个购物列表以及一个杂货列表。", - "speak": "我注意到你还没有Outlook任务簿, 我正在为您创建,包含一个待办事项列表,一个购物列表以及一个杂货列表。" - } - ], - "inputHint": "ignoringInput" - }, - "AfterOutlookSetupMessage": { - "replies": [ - { - "text": "设置完成,我已经给你发送带有Outlook任务簿链接的邮件,现在可以记录你的任务了。", - "speak": "设置完成,我已经给你发送带有Outlook任务簿链接的邮件,现在可以记录你的任务了。" - } - ], - "inputHint": "ignoringInput" - }, - "ShowToDoTasks": { - "replies": [ - { - "text": "您的{listType}列表有{taskCount}个任务:", - "speak": "您的{listType}列表有{taskCount}个任务:" - } - ], - "inputHint": "ignoringInput" - }, - "AskToDoTaskIndex": { - "replies": [ - { - "text": "您想为这个操作选择哪个任务?", - "speak": "您想为这个操作选择哪个任务?" - } - ], - "inputHint": "expectingInput" - }, - "AskToDoContentText": { - "replies": [ - { - "text": "当然。您想加入什么到事项表?", - "speak": "当然。您想加入什么到待办事项表?" - }, - { - "text": "好的,您想加入什么到事项表?", - "speak": "好的,您想加入什么到事项表?" - }, - { - "text": "好,您想加入什么到事项表?", - "speak": "好,您想加入什么到事项表?" - }, - { - "text": "您想加入什么到事项表?", - "speak": "您想加入什么到事项表?" - } - ], - "inputHint": "expectingInput" - }, - "AfterToDoTaskAdded": { - "replies": [ - { - "text": "已经为您加入此任务。", - "speak": "已经为您加入此任务。" - } - ], - "inputHint": "acceptingInput" - }, - "NoTasksInList": { - "replies": [ - { - "text": "您的事项表是空的.", - "speak": "您的事项表是空的." - } - ], - "inputHint": "acceptingInput" - }, - "SwitchListType": { - "replies": [ - { - "text": "这看起来像是{listType}列表的任务。你想要把它加入到{listType}列表吗?", - "speak": "这看起来像是{listType}列表的任务。你想要把它加入到{listType}列表吗?" - } - ], - "inputHint": "expectingInput" - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/FakeSkill.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/FakeSkill.cs deleted file mode 100644 index ee2b3ea20d..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/FakeSkill.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Bot.Builder; -using Microsoft.Bot.Builder.Dialogs; -using Microsoft.Bot.Builder.Solutions.Skills; -using FakeSkill.Dialogs.Main; -using FakeSkill.ServiceClients; -using Microsoft.Bot.Builder.Solutions.Responses; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Auth.Resources; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Main.Resources; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Shared.Resources; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Sample.Resources; -using Microsoft.Bot.Configuration; -using Microsoft.Bot.Builder.Solutions.TaskExtensions; -using Microsoft.Bot.Builder.Solutions.Proactive; - -namespace FakeSkill -{ - /// - /// Main entry point and orchestration for bot. - /// - public class FakeSkill : IBot - { - private readonly SkillConfigurationBase _services; - private readonly ResponseManager _responseManager; - private readonly ConversationState _conversationState; - private readonly UserState _userState; - private readonly ProactiveState _proactiveState; - private readonly IBotTelemetryClient _telemetryClient; - private readonly IBackgroundTaskQueue _backgroundTaskQueue; - private readonly EndpointService _endpointService; - private IServiceManager _serviceManager; - private DialogSet _dialogs; - private bool _skillMode; - - public FakeSkill(SkillConfigurationBase services, EndpointService endpointService, ConversationState conversationState, UserState userState, ProactiveState proactiveState, IBotTelemetryClient telemetryClient, IBackgroundTaskQueue backgroundTaskQueue, bool skillMode = false, ResponseManager responseManager = null, ServiceManager serviceManager = null) - { - _skillMode = skillMode; - _services = services ?? throw new ArgumentNullException(nameof(services)); - _userState = userState ?? throw new ArgumentNullException(nameof(userState)); - _conversationState = conversationState ?? throw new ArgumentNullException(nameof(conversationState)); - _proactiveState = proactiveState; - _endpointService = endpointService; - _backgroundTaskQueue = backgroundTaskQueue; - _telemetryClient = telemetryClient ?? throw new ArgumentNullException(nameof(telemetryClient)); - _serviceManager = serviceManager ?? new ServiceManager(); - - if(responseManager == null) - { - var locales = new string[] { "en-us", "de-de", "es-es", "fr-fr", "it-it", "zh-cn" }; - responseManager = new ResponseManager( - locales, - new SampleAuthResponses(), - new MainResponses(), - new SharedResponses(), - new SampleResponses()); - } - - _responseManager = responseManager; - _dialogs = new DialogSet(_conversationState.CreateProperty(nameof(DialogState))); - _dialogs.Add(new MainDialog(_services, _responseManager, _conversationState, _userState, _telemetryClient, _serviceManager, _skillMode)); - } - - /// - /// Run every turn of the conversation. Handles orchestration of messages. - /// - /// Bot Turn Context. - /// Task CancellationToken. - /// A representing the asynchronous operation. - public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken) - { - var dc = await _dialogs.CreateContextAsync(turnContext); - - if (dc.ActiveDialog != null) - { - var result = await dc.ContinueDialogAsync(); - } - else - { - await dc.BeginDialogAsync(nameof(MainDialog)); - } - } - } -} \ No newline at end of file diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/ServiceClients/IServiceManager.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/ServiceClients/IServiceManager.cs deleted file mode 100644 index 07702d2220..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/ServiceClients/IServiceManager.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace FakeSkill.ServiceClients -{ - public interface IServiceManager - { - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/ServiceClients/ServiceManager.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/ServiceClients/ServiceManager.cs deleted file mode 100644 index 45785c8a4b..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/ServiceClients/ServiceManager.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace FakeSkill.ServiceClients -{ - public class ServiceManager : IServiceManager - { - } -} \ No newline at end of file diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/SkillConversationState.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/SkillConversationState.cs deleted file mode 100644 index 75a7f462e5..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/SkillConversationState.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.Bot.Builder.Dialogs; - -namespace FakeSkill -{ - public class SkillConversationState : DialogState - { - public SkillConversationState() - { - } - - public string Token { get; internal set; } - - public void Clear() - { - } - } -} \ No newline at end of file diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/SkillUserState.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/SkillUserState.cs deleted file mode 100644 index e7ea23581d..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Fakes/FakeSkill/SkillUserState.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Microsoft.Bot.Builder.Dialogs; - -namespace FakeSkill -{ - public class SkillUserState : DialogState - { - public SkillUserState() - { - } - - public void Clear() - { - } - } -} \ No newline at end of file diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/InvokeSkillTests.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/InvokeSkillTests.cs deleted file mode 100644 index 600b9db0ac..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/InvokeSkillTests.cs +++ /dev/null @@ -1,135 +0,0 @@ -using Microsoft.Bot.Schema; -using Microsoft.Bot.Builder.Solutions.Skills; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Sample.Resources; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Utterances; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.Collections.Specialized; -using System.Globalization; -using System.Threading.Tasks; - -namespace Microsoft.Bot.Builder.Solutions.Tests.Skills -{ - [TestClass] - public class InvokeSkillTests : SkillTestBase - { - [TestInitialize] - public void InitSkills() - { - // Add Fake Skill registration - const string fakeSkillName = "FakeSkill"; - var fakeSkillDefinition = new SkillDefinition(); - var fakeSkillType = typeof(FakeSkill.FakeSkill); - fakeSkillDefinition.Assembly = fakeSkillType.AssemblyQualifiedName; - fakeSkillDefinition.Id = fakeSkillName; - fakeSkillDefinition.Name = fakeSkillName; - - SkillConfigurations.Add(fakeSkillDefinition.Id, Services); - - // Options are passed to the SkillDialog - SkillDialogOptions = new SkillDialogOptions - { - SkillDefinition = fakeSkillDefinition - }; - - // Add the SkillDialog to the available dialogs passing the initialized FakeSkill - Dialogs.Add(new SkillDialog(fakeSkillDefinition, Services, null, null, TelemetryClient, null)); - } - - /// - /// Test that we can create a skill and complete a end to end flow includign the EndOfConversation event - /// signalling the Skill has completed. - /// - /// - [TestMethod] - public async Task InvokeFakeSkillAndDialog() - { - await GetTestFlow() - .Send(SampleDialogUtterances.Trigger) - .AssertReply(MessagePrompt()) - .Send(SampleDialogUtterances.MessagePromptResponse) - .AssertReply(EchoMessage()) - .AssertReply(this.CheckForEndOfConversationEvent()) - .StartTestAsync(); - } - - /// - /// Replica of above test but testing that localisation is working - /// - /// - [TestMethod] - public async Task InvokeFakeSkillAndDialog_Spanish() - { - var locale = "es-mx"; - - // Set the culture to ES to ensure the reply asserts pull out the spanish variant - CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(locale); - - // Use MakeActivity so we can control the locale on the Activity being sent - await GetTestFlow() - .Send(MakeActivity(SampleDialogUtterances.Trigger, locale)) - .AssertReply(MessagePrompt()) - .Send(MakeActivity(SampleDialogUtterances.MessagePromptResponse, locale)) - .AssertReply(EchoMessage()) - .AssertReply(this.CheckForEndOfConversationEvent()) - .StartTestAsync(); - } - - /// - /// Make an activity using the pre-configured Conversation metadata providing a way to control locale - /// - /// - /// - /// - public Activity MakeActivity(string text = null, string locale = null) - { - var activity = new Activity - { - Type = ActivityTypes.Message, - From = ConversationReference.User, - Recipient = ConversationReference.Bot, - Conversation = ConversationReference.Conversation, - ServiceUrl = ConversationReference.ServiceUrl, - Text = text, - Locale = locale ?? null - }; - - return activity; - } - - /// - /// Validate that we have received a EndOfConversation event. The SkillDialog internally consumes this but does - /// send a Trace Event that we check for the presence of. - /// - /// - private Action CheckForEndOfConversationEvent() - { - return activity => - { - var traceActivity = activity as Activity; - Assert.IsNotNull(traceActivity); - - Assert.AreEqual(traceActivity.Type, ActivityTypes.Trace); - Assert.AreEqual(traceActivity.Text, "<--Ending the skill conversation"); - }; - } - - private Action MessagePrompt() - { - return activity => - { - var messageActivity = activity.AsMessageActivity(); - CollectionAssert.Contains(ParseReplies(SampleResponses.MessagePrompt, new StringDictionary()), messageActivity.Text); - }; - } - - private Action EchoMessage() - { - return activity => - { - var messageActivity = activity.AsMessageActivity(); - CollectionAssert.Contains(ParseReplies(SampleResponses.MessageResponse, new[] { SampleDialogUtterances.MessagePromptResponse }), messageActivity.Text); - }; - } - } -} \ No newline at end of file diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/LuisTestUtils/FakeSkillTestUtil.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/LuisTestUtils/FakeSkillTestUtil.cs deleted file mode 100644 index 8bf009194c..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/LuisTestUtils/FakeSkillTestUtil.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Luis; -using Microsoft.Bot.Builder; -using Microsoft.Bot.Builder.Solutions.Testing.Mocks; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Utterances; -using System.Collections.Generic; - -namespace Microsoft.Bot.Builder.Solutions.Tests.Skills.LuisTestUtils -{ - public class FakeSkillTestUtil - { - private static Dictionary _utterances = new Dictionary - { - { SampleDialogUtterances.Trigger, CreateIntent(SampleDialogUtterances.Trigger, FakeSkillLU.Intent.Sample) }, - { SampleDialogUtterances.Auth, CreateIntent(SampleDialogUtterances.Auth, FakeSkillLU.Intent.Auth) } - }; - - public static MockLuisRecognizer CreateRecognizer() - { - var recognizer = new MockLuisRecognizer(defaultIntent: CreateIntent(string.Empty, FakeSkillLU.Intent.None)); - recognizer.RegisterUtterances(_utterances); - return recognizer; - } - - public static FakeSkillLU CreateIntent(string userInput, FakeSkillLU.Intent intent) - { - var result = new FakeSkillLU - { - Text = userInput, - Intents = new Dictionary() - }; - - result.Intents.Add(intent, new IntentScore() { Score = 0.9 }); - - result.Entities = new FakeSkillLU._Entities - { - _instance = new FakeSkillLU._Entities._Instance() - }; - - return result; - } - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/LuisTestUtils/GeneralTestUtil.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/LuisTestUtils/GeneralTestUtil.cs deleted file mode 100644 index 30aaab73a1..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/LuisTestUtils/GeneralTestUtil.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Luis; -using Microsoft.Bot.Builder; -using Microsoft.Bot.Builder.Solutions.Testing.Mocks; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Utterances; -using System.Collections.Generic; - -namespace Microsoft.Bot.Builder.Solutions.Tests.Skills.LuisTestUtils -{ - public class GeneralTestUtil - { - private static Dictionary _utterances = new Dictionary - { - { GeneralUtterances.Cancel, CreateIntent(GeneralUtterances.Cancel, General.Intent.Cancel) }, - { GeneralUtterances.Escalate, CreateIntent(GeneralUtterances.Escalate, General.Intent.Escalate) }, - { GeneralUtterances.Help, CreateIntent(GeneralUtterances.Help, General.Intent.Help) }, - { GeneralUtterances.Logout, CreateIntent(GeneralUtterances.Logout, General.Intent.Logout) }, - { GeneralUtterances.Next, CreateIntent(GeneralUtterances.Next, General.Intent.ShowNext) }, - { GeneralUtterances.Previous, CreateIntent(GeneralUtterances.Previous, General.Intent.ShowPrevious) }, - { GeneralUtterances.Restart, CreateIntent(GeneralUtterances.Restart, General.Intent.GoBack) }, - }; - - public static MockLuisRecognizer CreateRecognizer() - { - var recognizer = new MockLuisRecognizer(defaultIntent: CreateIntent(string.Empty, General.Intent.None)); - recognizer.RegisterUtterances(_utterances); - return recognizer; - } - - public static General CreateIntent(string userInput, General.Intent intent) - { - var result = new General - { - Text = userInput, - Intents = new Dictionary() - }; - - result.Intents.Add(intent, new IntentScore() { Score = 0.9 }); - - result.Entities = new General._Entities - { - _instance = new General._Entities._Instance() - }; - - return result; - } - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/MisconfiguredSkillTest.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/MisconfiguredSkillTest.cs deleted file mode 100644 index 44e15855f6..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/MisconfiguredSkillTest.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.Bot.Builder.Solutions.Skills; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Utterances; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Threading.Tasks; - -namespace Microsoft.Bot.Builder.Solutions.Tests.Skills -{ - [TestClass] - public class MisconfiguredSkillTest : SkillTestBase - { - [TestInitialize] - public void InitSkills() - { - // Add Fake Skill registration - const string fakeSkillName = "FakeSkill"; - var fakeSkillDefinition = new SkillDefinition(); - var fakeSkillType = typeof(FakeSkill.FakeSkill); - fakeSkillDefinition.Id = fakeSkillName; - fakeSkillDefinition.Name = fakeSkillName; - - // Set Assembly name to invalid value - fakeSkillDefinition.Assembly = "FakeSkill.FakeSkil, Microsoft.Bot.Builder.Solutions.Tests, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null"; - - SkillConfigurations.Add(fakeSkillDefinition.Id, Services); - - // Options are passed to the SkillDialog - SkillDialogOptions = new SkillDialogOptions(); - SkillDialogOptions.SkillDefinition = fakeSkillDefinition; - - // Add the SkillDialog to the available dialogs passing the initialized FakeSkill - Dialogs.Add(new SkillDialog(fakeSkillDefinition, Services, null, null, TelemetryClient, null)); - } - - /// - /// Validate that Skill instantiation errors are surfaced as exceptions - /// - /// - [TestMethod] - [ExpectedException(typeof(System.InvalidOperationException), "Skill (FakeSkill) could not be created.")] - public async Task MisconfiguredSkill() - { - await GetTestFlow() - .Send(SampleDialogUtterances.Trigger) - .StartTestAsync(); - } - } -} \ No newline at end of file diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/SkillTestBase.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/SkillTestBase.cs deleted file mode 100644 index d6ca8b45df..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/SkillTestBase.cs +++ /dev/null @@ -1,153 +0,0 @@ -using System.Collections.Generic; -using Autofac; -using Microsoft.Bot.Builder; -using Microsoft.Bot.Builder.Adapters; -using Microsoft.Bot.Builder.Dialogs; -using Microsoft.Bot.Configuration; -using Microsoft.Bot.Schema; -using Microsoft.Bot.Builder.Solutions.Proactive; -using Microsoft.Bot.Builder.Solutions.Responses; -using Microsoft.Bot.Builder.Solutions.Skills; -using Microsoft.Bot.Builder.Solutions.TaskExtensions; -using Microsoft.Bot.Builder.Solutions.Telemetry; -using Microsoft.Bot.Builder.Solutions.Testing; -using Microsoft.Bot.Builder.Solutions.Testing.Mocks; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Auth.Resources; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Main.Resources; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Sample.Resources; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.Fakes.FakeSkill.Dialogs.Shared.Resources; -using Microsoft.Bot.Builder.Solutions.Tests.Skills.LuisTestUtils; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Microsoft.Bot.Builder.Solutions.Tests.Skills -{ - [TestClass] - public class SkillTestBase : BotTestBase - { - public DialogSet Dialogs { get; set; } - - public UserState UserState { get; set; } - - public ConversationState ConversationState { get; set; } - - public ProactiveState ProactiveState { get; set; } - - public IStatePropertyAccessor DialogState { get; set; } - - public IBotTelemetryClient TelemetryClient { get; set; } - - public IBackgroundTaskQueue BackgroundTaskQueue { get; set; } - - public EndpointService EndpointService { get; set; } - - public SkillConfigurationBase Services { get; set; } - - public Dictionary SkillConfigurations { get; set; } - - public SkillDialogOptions SkillDialogOptions { get; set; } - - public ConversationReference ConversationReference { get; set; } - - [TestInitialize] - public new void Initialize() - { - var builder = new ContainerBuilder(); - - ConversationState = new ConversationState(new MemoryStorage()); - DialogState = ConversationState.CreateProperty(nameof(DialogState)); - UserState = new UserState(new MemoryStorage()); - ProactiveState = new ProactiveState(new MemoryStorage()); - TelemetryClient = new NullBotTelemetryClient(); - BackgroundTaskQueue = new BackgroundTaskQueue(); - EndpointService = new EndpointService(); - SkillConfigurations = new Dictionary(); - - // Add the LUIS model fakes used by the Skill - Services = new MockSkillConfiguration(); - Services.LocaleConfigurations.Add("en", new LocaleConfiguration() - { - Locale = "en-us", - LuisServices = new Dictionary - { - { "general", GeneralTestUtil.CreateRecognizer() }, - { "FakeSkill", FakeSkillTestUtil.CreateRecognizer() } - } - }); - - Services.LocaleConfigurations.Add("es", new LocaleConfiguration() - { - Locale = "es-mx", - LuisServices = new Dictionary - { - { "general", GeneralTestUtil.CreateRecognizer() }, - { "FakeSkill", FakeSkillTestUtil.CreateRecognizer() } - } - }); - - // Dummy Authentication connection for Auth testing - Services.AuthenticationConnections = new Dictionary - { - { "DummyAuth", "DummyAuthConnection" } - }; - - builder.RegisterInstance(new BotStateSet(UserState, ConversationState)); - Container = builder.Build(); - - Dialogs = new DialogSet(DialogState); - - var locales = new string[] { "en-us", "de-de", "es-es", "fr-fr", "it-it", "zh-cn" }; - ResponseManager = new ResponseManager( - locales, - new SampleAuthResponses(), - new MainResponses(), - new SharedResponses(), - new SampleResponses()); - - // Manually mange the conversation metadata when we need finer grained control - ConversationReference = new ConversationReference - { - ChannelId = "test", - ServiceUrl = "https://test.com", - }; - - ConversationReference.User = new ChannelAccount("user1", "User1"); - ConversationReference.Bot = new ChannelAccount("bot", "Bot"); - ConversationReference.Conversation = new ConversationAccount(false, "convo1", "Conversation1"); - } - - /// - /// Create a TestFlow which spins up a CustomSkillDialog ready for the tests to execute against - /// - /// - /// - /// - public TestFlow GetTestFlow(string locale = null, SkillDialogOptions overrideSkillDialogOptions = null) - { - var adapter = new TestAdapter(sendTraceActivity: true) - .Use(new AutoSaveStateMiddleware(ConversationState)); - - var testFlow = new TestFlow(adapter, async (context, cancellationToken) => - { - var dc = await Dialogs.CreateContextAsync(context); - - if (dc.ActiveDialog != null) - { - var result = await dc.ContinueDialogAsync(); - } - else - { - var options = overrideSkillDialogOptions ?? SkillDialogOptions; - await dc.BeginDialogAsync(options.SkillDefinition.Id, options); - var result = await dc.ContinueDialogAsync(); - } - }); - - return testFlow; - } - - public override IBot BuildBot() - { - return new FakeSkill.FakeSkill(Services, EndpointService, ConversationState, UserState, ProactiveState, TelemetryClient, BackgroundTaskQueue, true, ResponseManager, null); - } - } -} \ No newline at end of file diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/GeneralUtterances.Designer.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/GeneralUtterances.Designer.cs deleted file mode 100644 index c0fcfad371..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/GeneralUtterances.Designer.cs +++ /dev/null @@ -1,144 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Bot.Builder.Solutions.Tests.Skills.Utterances { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class GeneralUtterances { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal GeneralUtterances() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Bot.Builder.Solutions.Tests.Skills.Utterances.GeneralUtterances", typeof(GeneralUtterances).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to cancel. - /// - public static string Cancel { - get { - return ResourceManager.GetString("Cancel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to can i talk to a person. - /// - public static string Escalate { - get { - return ResourceManager.GetString("Escalate", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to goodbye. - /// - public static string Goodbye { - get { - return ResourceManager.GetString("Goodbye", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Hi. - /// - public static string Greeting { - get { - return ResourceManager.GetString("Greeting", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to help. - /// - public static string Help { - get { - return ResourceManager.GetString("Help", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to log out. - /// - public static string Logout { - get { - return ResourceManager.GetString("Logout", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to next please. - /// - public static string Next { - get { - return ResourceManager.GetString("Next", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to last one. - /// - public static string Previous { - get { - return ResourceManager.GetString("Previous", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to start over. - /// - public static string Restart { - get { - return ResourceManager.GetString("Restart", resourceCulture); - } - } - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/GeneralUtterances.resx b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/GeneralUtterances.resx deleted file mode 100644 index b851d23083..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/GeneralUtterances.resx +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - cancel - - - can i talk to a person - - - goodbye - - - Hi - - - help - - - log out - - - next please - - - last one - - - start over - - \ No newline at end of file diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/SampleDialogUtterances.Designer.cs b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/SampleDialogUtterances.Designer.cs deleted file mode 100644 index 3b026c25cc..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/SampleDialogUtterances.Designer.cs +++ /dev/null @@ -1,90 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Bot.Builder.Solutions.Tests.Skills.Utterances { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class SampleDialogUtterances { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal SampleDialogUtterances() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Bot.Builder.Solutions.Tests.Skills.Utterances.SampleDialogUtterances", typeof(SampleDialogUtterances).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to auth. - /// - public static string Auth { - get { - return ResourceManager.GetString("Auth", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to this is a message. - /// - public static string MessagePromptResponse { - get { - return ResourceManager.GetString("MessagePromptResponse", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to test. - /// - public static string Trigger { - get { - return ResourceManager.GetString("Trigger", resourceCulture); - } - } - } -} diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/SampleDialogUtterances.resx b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/SampleDialogUtterances.resx deleted file mode 100644 index eaf7247dd9..0000000000 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Skills/Utterances/SampleDialogUtterances.resx +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - auth - - - this is a message - - - test - - \ No newline at end of file diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Adapters/AutomotiveSkillAdapter.cs b/skills/src/csharp/automotiveskill/automotiveskill/Adapters/AutomotiveSkillAdapter.cs index 2d06f8592b..50c60707e4 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Adapters/AutomotiveSkillAdapter.cs +++ b/skills/src/csharp/automotiveskill/automotiveskill/Adapters/AutomotiveSkillAdapter.cs @@ -37,6 +37,7 @@ public AutomotiveSkillAdapter( Use(new SetLocaleMiddleware(settings.DefaultLocale ?? "en-us")); Use(new EventDebuggerMiddleware()); Use(new AutoSaveStateMiddleware(userState, conversationState)); + Use(new SkillMiddleware(userState)); } } } \ No newline at end of file diff --git a/skills/src/csharp/calendarskill/calendarskill/Adapters/CalendarSkillAdapter.cs b/skills/src/csharp/calendarskill/calendarskill/Adapters/CalendarSkillAdapter.cs index c4a49663ba..2e5ebda2be 100644 --- a/skills/src/csharp/calendarskill/calendarskill/Adapters/CalendarSkillAdapter.cs +++ b/skills/src/csharp/calendarskill/calendarskill/Adapters/CalendarSkillAdapter.cs @@ -19,7 +19,8 @@ public CalendarSkillAdapter( ICredentialProvider credentialProvider, BotStateSet botStateSet, ResponseManager responseManager, - IBotTelemetryClient telemetryClient) + IBotTelemetryClient telemetryClient, + UserState userState) : base(credentialProvider) { OnTurnError = async (context, exception) => @@ -36,6 +37,7 @@ public CalendarSkillAdapter( Use(new SetLocaleMiddleware(settings.DefaultLocale ?? "en-us")); Use(new EventDebuggerMiddleware()); Use(new AutoSaveStateMiddleware(botStateSet)); + Use(new SkillMiddleware(userState)); } } } \ No newline at end of file diff --git a/skills/src/csharp/emailskill/emailskill/Adapters/EmailSkillAdapter.cs b/skills/src/csharp/emailskill/emailskill/Adapters/EmailSkillAdapter.cs index cd0b6ff814..dd21804b6f 100644 --- a/skills/src/csharp/emailskill/emailskill/Adapters/EmailSkillAdapter.cs +++ b/skills/src/csharp/emailskill/emailskill/Adapters/EmailSkillAdapter.cs @@ -19,7 +19,8 @@ public EmailSkillAdapter( ICredentialProvider credentialProvider, BotStateSet botStateSet, ResponseManager responseManager, - IBotTelemetryClient telemetryClient) + IBotTelemetryClient telemetryClient, + UserState userState) : base(credentialProvider) { OnTurnError = async (context, exception) => @@ -36,6 +37,7 @@ public EmailSkillAdapter( Use(new SetLocaleMiddleware(settings.DefaultLocale ?? "en-us")); Use(new EventDebuggerMiddleware()); Use(new AutoSaveStateMiddleware(botStateSet)); + Use(new SkillMiddleware(userState)); } } } \ No newline at end of file diff --git a/skills/src/csharp/experimental/newsskill/Adapters/NewsSkillAdapter.cs b/skills/src/csharp/experimental/newsskill/Adapters/NewsSkillAdapter.cs index f7ce5a6150..cad89b4684 100644 --- a/skills/src/csharp/experimental/newsskill/Adapters/NewsSkillAdapter.cs +++ b/skills/src/csharp/experimental/newsskill/Adapters/NewsSkillAdapter.cs @@ -35,6 +35,7 @@ public NewsSkillAdapter( Use(new SetLocaleMiddleware(settings.DefaultLocale ?? "en-us")); Use(new EventDebuggerMiddleware()); Use(new AutoSaveStateMiddleware(userState, conversationState)); + Use(new SkillMiddleware(userState)); } } } \ No newline at end of file diff --git a/skills/src/csharp/experimental/restaurantbooking/Adapters/RestaurantSkillAdapter.cs b/skills/src/csharp/experimental/restaurantbooking/Adapters/RestaurantSkillAdapter.cs index 06d480e527..fafe132e30 100644 --- a/skills/src/csharp/experimental/restaurantbooking/Adapters/RestaurantSkillAdapter.cs +++ b/skills/src/csharp/experimental/restaurantbooking/Adapters/RestaurantSkillAdapter.cs @@ -37,6 +37,7 @@ public RestaurantSkillAdapter( Use(new SetLocaleMiddleware(settings.DefaultLocale ?? "en-us")); Use(new EventDebuggerMiddleware()); Use(new AutoSaveStateMiddleware(userState, conversationState)); + Use(new SkillMiddleware(userState)); } } } \ No newline at end of file diff --git a/skills/src/csharp/pointofinterestskill/pointofinterestskill/Adapters/POISkillAdapter.cs b/skills/src/csharp/pointofinterestskill/pointofinterestskill/Adapters/POISkillAdapter.cs index 937f13108a..3fabfa1b64 100644 --- a/skills/src/csharp/pointofinterestskill/pointofinterestskill/Adapters/POISkillAdapter.cs +++ b/skills/src/csharp/pointofinterestskill/pointofinterestskill/Adapters/POISkillAdapter.cs @@ -19,7 +19,8 @@ public POISkillAdapter( ICredentialProvider credentialProvider, BotStateSet botStateSet, ResponseManager responseManager, - IBotTelemetryClient telemetryClient) + IBotTelemetryClient telemetryClient, + UserState userState) : base(credentialProvider) { OnTurnError = async (context, exception) => @@ -36,6 +37,7 @@ public POISkillAdapter( Use(new SetLocaleMiddleware(settings.DefaultLocale ?? "en-us")); Use(new EventDebuggerMiddleware()); Use(new AutoSaveStateMiddleware(botStateSet)); + Use(new SkillMiddleware(userState)); } } } \ No newline at end of file diff --git a/skills/src/csharp/todoskill/todoskill/Adapters/ToDoSkillAdapter.cs b/skills/src/csharp/todoskill/todoskill/Adapters/ToDoSkillAdapter.cs index a54658f774..0ed4d187da 100644 --- a/skills/src/csharp/todoskill/todoskill/Adapters/ToDoSkillAdapter.cs +++ b/skills/src/csharp/todoskill/todoskill/Adapters/ToDoSkillAdapter.cs @@ -37,6 +37,7 @@ public ToDoSkillAdapter( Use(new SetLocaleMiddleware(settings.DefaultLocale ?? "en-us")); Use(new EventDebuggerMiddleware()); Use(new AutoSaveStateMiddleware(userState, conversationState)); + Use(new SkillMiddleware(userState)); } } } From b45322425af9c0830811bfd21514516f7bbbc276 Mon Sep 17 00:00:00 2001 From: Darren Jefford Date: Mon, 15 Apr 2019 11:10:49 +0100 Subject: [PATCH 2/3] populate skillcontext inside skill --- .../Dialogs/BookingDialog.cs | 2 +- .../restaurantbooking/Dialogs/MainDialog.cs | 17 ++++++ .../Models/RestaurantBookingState.cs | 3 + .../Dialogs/MainDialog.cs | 60 +++++++++++-------- 4 files changed, 55 insertions(+), 27 deletions(-) diff --git a/skills/src/csharp/experimental/restaurantbooking/Dialogs/BookingDialog.cs b/skills/src/csharp/experimental/restaurantbooking/Dialogs/BookingDialog.cs index 8ad57e631f..06dbfa3870 100644 --- a/skills/src/csharp/experimental/restaurantbooking/Dialogs/BookingDialog.cs +++ b/skills/src/csharp/experimental/restaurantbooking/Dialogs/BookingDialog.cs @@ -91,7 +91,7 @@ public BookingDialog( // This would be passed from the Virtual Assistant moving forward var tokens = new StringDictionary { - { "UserName", "Jane" } + { "UserName", state.Name ?? "Unknown" } }; // Start the flow diff --git a/skills/src/csharp/experimental/restaurantbooking/Dialogs/MainDialog.cs b/skills/src/csharp/experimental/restaurantbooking/Dialogs/MainDialog.cs index 1a77537c07..20ed0cc5b2 100644 --- a/skills/src/csharp/experimental/restaurantbooking/Dialogs/MainDialog.cs +++ b/skills/src/csharp/experimental/restaurantbooking/Dialogs/MainDialog.cs @@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Dialogs; +using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions.Dialogs; using Microsoft.Bot.Builder.Solutions.Responses; using Microsoft.Bot.Schema; @@ -118,6 +119,22 @@ public MainDialog( } } + private async Task PopulateStateFromSkillContext(ITurnContext context) + { + // If we have a SkillContext object populated from the SkillMiddleware we can retrieve requests slot (parameter) data + // and make available in local state as appropriate. + var accessor = _userState.CreateProperty(nameof(SkillContext)); + var skillContext = await accessor.GetAsync(context, () => new SkillContext()); + if (skillContext != null) + { + if (skillContext.ContainsKey("Name")) + { + var state = await _conversationStateAccessor.GetAsync(context, () => new RestaurantBookingState()); + state.Name = skillContext["Name"] as string; + } + } + } + protected override async Task CompleteAsync(DialogContext dc, DialogTurnResult result = null, CancellationToken cancellationToken = default(CancellationToken)) { var response = dc.Context.Activity.CreateReply(); diff --git a/skills/src/csharp/experimental/restaurantbooking/Models/RestaurantBookingState.cs b/skills/src/csharp/experimental/restaurantbooking/Models/RestaurantBookingState.cs index 66e9d9ceed..6602839bdc 100644 --- a/skills/src/csharp/experimental/restaurantbooking/Models/RestaurantBookingState.cs +++ b/skills/src/csharp/experimental/restaurantbooking/Models/RestaurantBookingState.cs @@ -11,6 +11,8 @@ public RestaurantBookingState() AmbiguousTimexExpressions = new Dictionary(); } + public string Name { get; set; } + public Luis.ReservationLuis LuisResult { get; set; } public ReservationBooking Booking { get; set; } @@ -23,6 +25,7 @@ public RestaurantBookingState() public void Clear() { + Name = null; LuisResult = null; Booking = null; Cuisine = null; diff --git a/skills/src/csharp/pointofinterestskill/pointofinterestskill/Dialogs/MainDialog.cs b/skills/src/csharp/pointofinterestskill/pointofinterestskill/Dialogs/MainDialog.cs index 6ad57dbd8a..5aa6b8af6d 100644 --- a/skills/src/csharp/pointofinterestskill/pointofinterestskill/Dialogs/MainDialog.cs +++ b/skills/src/csharp/pointofinterestskill/pointofinterestskill/Dialogs/MainDialog.cs @@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Dialogs; +using Microsoft.Bot.Builder.Skills; using Microsoft.Bot.Builder.Solutions.Dialogs; using Microsoft.Bot.Builder.Solutions.Responses; using Microsoft.Bot.Schema; @@ -63,7 +64,7 @@ public MainDialog( protected override async Task OnStartAsync(DialogContext dc, CancellationToken cancellationToken = default(CancellationToken)) { // send a greeting if we're in local mode - await dc.Context.SendActivityAsync(_responseManager.GetResponse(POIMainResponses.PointOfInterestWelcomeMessage)); + await dc.Context.SendActivityAsync(_responseManager.GetResponse(POIMainResponses.PointOfInterestWelcomeMessage)); } protected override async Task RouteAsync(DialogContext dc, CancellationToken cancellationToken = default(CancellationToken)) @@ -72,6 +73,8 @@ public MainDialog( var locale = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName; var localeConfig = _services.CognitiveModelSets[locale]; + await PopulateStateFromSkillContext(dc.Context); + // If dispatch result is general luis model localeConfig.LuisServices.TryGetValue("pointofinterest", out var luisService); @@ -136,6 +139,36 @@ public MainDialog( } } + private async Task PopulateStateFromSkillContext(ITurnContext context) + { + // If we have a SkillContext object populated from the SkillMiddleware we can retrieve requests slot (parameter) data + // and make available in local state as appropriate. + var accessor = _userState.CreateProperty(nameof(SkillContext)); + var skillContext = await accessor.GetAsync(context, () => new SkillContext()); + if (skillContext != null) + { + if (skillContext.ContainsKey("Location")) + { + var location = skillContext["Location"]; + var coords = ((string)location).Split(','); + if (coords.Length == 2) + { + if (double.TryParse(coords[0], out var lat) && double.TryParse(coords[1], out var lng)) + { + var coordinates = new LatLng + { + Latitude = lat, + Longitude = lng, + }; + + var state = await _stateAccessor.GetAsync(context, () => new PointOfInterestSkillState()); + state.CurrentCoordinates = coordinates; + } + } + } + } + } + protected override async Task CompleteAsync(DialogContext dc, DialogTurnResult result = null, CancellationToken cancellationToken = default(CancellationToken)) { var response = dc.Context.Activity.CreateReply(); @@ -153,31 +186,6 @@ public MainDialog( switch (dc.Context.Activity.Name) { - case Events.SkillBeginEvent: - { - if (dc.Context.Activity.Value is Dictionary userData) - { - if (userData.TryGetValue("IPA.Location", out var location)) - { - var coords = ((string)location).Split(','); - if (coords.Length == 2) - { - if (double.TryParse(coords[0], out var lat) && double.TryParse(coords[1], out var lng)) - { - var coordinates = new LatLng - { - Latitude = lat, - Longitude = lng, - }; - state.CurrentCoordinates = coordinates; - } - } - } - } - - break; - } - case Events.Location: { // Test trigger with From 950ca2a0533311f61d45286bd3657df47bbf978c Mon Sep 17 00:00:00 2001 From: Darren Jefford Date: Mon, 15 Apr 2019 11:16:00 +0100 Subject: [PATCH 3/3] remove fakeskill from solutions.tests --- ...crosoft.Bot.Builder.Solutions.Tests.csproj | 135 +----------------- 1 file changed, 6 insertions(+), 129 deletions(-) diff --git a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Microsoft.Bot.Builder.Solutions.Tests.csproj b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Microsoft.Bot.Builder.Solutions.Tests.csproj index d0ead6771d..420a17ec7b 100644 --- a/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Microsoft.Bot.Builder.Solutions.Tests.csproj +++ b/lib/csharp/microsoft.bot.builder.solutions/microsoft.bot.builder.solutions.tests/Microsoft.Bot.Builder.Solutions.Tests.csproj @@ -6,81 +6,15 @@ false + + + + + + - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - @@ -98,22 +32,6 @@ TextTemplatingFileGenerator TestResponses.cs - - TextTemplatingFileGenerator - SampleAuthResponses.cs - - - TextTemplatingFileGenerator - MainResponses.cs - - - TextTemplatingFileGenerator - SampleResponses.cs - - - TextTemplatingFileGenerator - SharedResponses.cs - @@ -126,47 +44,6 @@ True TestResponses.tt - - True - True - SampleAuthResponses.tt - - - True - True - MainResponses.tt - - - True - True - SampleResponses.tt - - - True - True - SharedResponses.tt - - - True - True - GeneralUtterances.resx - - - True - True - SampleDialogUtterances.resx - - - - - - PublicResXFileCodeGenerator - GeneralUtterances.Designer.cs - - - PublicResXFileCodeGenerator - SampleDialogUtterances.Designer.cs -