diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/ForEachElement.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/ForEachElement.cs index f43d22f973..9bcff70098 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/ForEachElement.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/ForEachElement.cs @@ -263,7 +263,6 @@ private DialogContext CreateChildContext(DialogContext dc, DialogState childDial private bool ShouldEndDialog(DialogTurnResult turnResult, out DialogTurnResult finalTurnResult) { - DialogTurnStatus[] endedDialog = { DialogTurnStatus.Complete, DialogTurnStatus.Cancelled }; finalTurnResult = null; // Insure BreakLoop ends the dialog @@ -280,12 +279,12 @@ private bool ShouldEndDialog(DialogTurnResult turnResult, out DialogTurnResult f // the result will be nested. while (finalTurnResult.Result != null && finalTurnResult.Result is DialogTurnResult dtr - && dtr.ParentEnded && endedDialog.Contains(dtr.Status)) + && dtr.ParentEnded && dtr.Status == DialogTurnStatus.Complete) { finalTurnResult = dtr; } - return finalTurnResult.ParentEnded && endedDialog.Contains(finalTurnResult.Status); + return finalTurnResult.ParentEnded && finalTurnResult.Status == DialogTurnStatus.Complete; } private void UpdateActionScopeState(DialogContext dc, DialogState state) diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/ActionTests.cs b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/ActionTests.cs index 895594711e..14d08fc017 100644 --- a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/ActionTests.cs +++ b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/ActionTests.cs @@ -296,12 +296,6 @@ public async Task Action_Foreach_Nested() await TestUtils.RunTestScript(_resourceExplorerFixture.ResourceExplorer); } - [Fact] - public async Task Action_Foreach_Nested_WithCancel() - { - await TestUtils.RunTestScript(_resourceExplorerFixture.ResourceExplorer); - } - [Fact] public async Task Action_Foreach_Object() { diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/Tests/ActionTests/Action_Foreach_Nested_WithCancel.test.dialog b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/Tests/ActionTests/Action_Foreach_Nested_WithCancel.test.dialog deleted file mode 100644 index d46caf6b5e..0000000000 --- a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/Tests/ActionTests/Action_Foreach_Nested_WithCancel.test.dialog +++ /dev/null @@ -1,67 +0,0 @@ -{ - "$schema": "../../../tests.schema", - "$kind": "Microsoft.Test.Script", - "dialog": { - "$kind": "Microsoft.AdaptiveDialog", - "id": "root", - "triggers": [ - { - "$kind": "Microsoft.OnBeginDialog", - "actions": [ - { - "$kind": "Microsoft.SetProperty", - "property": "dialog.todo", - "value": "=['1', '2', '3']" - }, - { - "$kind": "Microsoft.Foreach", - "itemsProperty": "dialog.todo", - "actions": [ - { - "$kind": "Microsoft.SendActivity", - "activity": "I'm the Parent loop - index is: ${dialog.foreach.index}" - }, - { - "$kind": "Microsoft.Foreach", - "itemsProperty": "dialog.todo", - "actions": [ - { - "$kind": "Microsoft.SendActivity", - "activity": "I'm the child loop and I will cancel all dialogs" - }, - { - "$kind": "Microsoft.CancelAllDialogs" - }, - { - "$kind": "Microsoft.SendActivity", - "activity": "This shouldn't be sent" - } - ] - }, - { - "$kind": "Microsoft.SendActivity", - "activity": "This shouldn't be sent either" - } - ] - } - ] - } - ], - "autoEndDialog": true, - "defaultResultProperty": "dialog.result" - }, - "script": [ - { - "$kind": "Microsoft.Test.UserSays", - "text": "hi" - }, - { - "$kind": "Microsoft.Test.AssertReply", - "text": "I'm the Parent loop - index is: 0" - }, - { - "$kind": "Microsoft.Test.AssertReply", - "text": "I'm the child loop and I will cancel all dialogs" - } - ] -}