Skip to content

Commit

Permalink
Updating Samples (microsoft#1350)
Browse files Browse the repository at this point in the history
* Updating Samples

* Removed unused LG templates
  • Loading branch information
luhan2017 authored and a-b-r-o-w-n committed Oct 30, 2019
1 parent 543fa87 commit 3ee7283
Show file tree
Hide file tree
Showing 14 changed files with 194 additions and 177 deletions.
22 changes: 11 additions & 11 deletions BotProject/CSharp/Tests/ActionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task Actions_01Actions()
{
await BuildTestFlow(getFolderPath("ActionsSample"))
.SendConversationUpdate()
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}", Environment.NewLine))
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}13 - QnAMaker", Environment.NewLine))
.Send("01")
.AssertReply("Step 1")
.AssertReply("Step 2")
Expand All @@ -60,7 +60,7 @@ public async Task Actions_02EndTurn()
{
await BuildTestFlow(getFolderPath("ActionsSample"))
.SendConversationUpdate()
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}", Environment.NewLine))
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}13 - QnAMaker", Environment.NewLine))
.Send("02")
.AssertReply("What's up?")
.Send("Nothing")
Expand All @@ -73,7 +73,7 @@ public async Task Actions_03IfCondition()
{
await BuildTestFlow(getFolderPath("ActionsSample"))
.SendConversationUpdate()
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}", Environment.NewLine)).Send("03")
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}13 - QnAMaker", Environment.NewLine)).Send("03")
.AssertReply("Hello, I'm Zoidberg. What is your name?")
.Send("Carlos")
.AssertReply("Hello Carlos, nice to talk to you!")
Expand All @@ -85,7 +85,7 @@ public async Task Actions_04EditArray()
{
await BuildTestFlow(getFolderPath("ActionsSample"))
.SendConversationUpdate()
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}", Environment.NewLine)).Send("04")
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}13 - QnAMaker", Environment.NewLine)).Send("04")
.AssertReply("Here are the index and values in the array.")
.AssertReply("0: 11111")
.AssertReply("1: 40000")
Expand All @@ -102,7 +102,7 @@ public async Task Actions_05EndDialog()
{
await BuildTestFlow(getFolderPath("ActionsSample"))
.SendConversationUpdate()
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}", Environment.NewLine)).Send("05")
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}13 - QnAMaker", Environment.NewLine)).Send("05")
.AssertReply("Hello, I'm Zoidberg. What is your name?")
.Send("luhan")
.AssertReply("Hello luhan, nice to talk to you!")
Expand All @@ -119,7 +119,7 @@ public async Task Actions_06SwitchCondition()
{
await BuildTestFlow(getFolderPath("ActionsSample"))
.SendConversationUpdate()
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}", Environment.NewLine)).Send("07")
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}13 - QnAMaker", Environment.NewLine)).Send("07")
.AssertReply("Please select a value from below:\n\n 1. Test1\n 2. Test2\n 3. Test3")
.Send("Test1")
.AssertReply("You select: Test1")
Expand All @@ -132,7 +132,7 @@ public async Task Actions_07RepeatDialog()
{
await BuildTestFlow(getFolderPath("ActionsSample"))
.SendConversationUpdate()
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}", Environment.NewLine)).Send("08")
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}13 - QnAMaker", Environment.NewLine)).Send("08")
.AssertReply("Do you want to repeat this dialog, yes to repeat, no to end this dialog (1) Yes or (2) No")
.Send("Yes")
.AssertReply("Do you want to repeat this dialog, yes to repeat, no to end this dialog (1) Yes or (2) No")
Expand All @@ -145,7 +145,7 @@ public async Task Actions_08TraceAndLog()
{
await BuildTestFlow(getFolderPath("ActionsSample"), sendTrace: true)
.SendConversationUpdate()
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}", Environment.NewLine)).Send("09")
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}13 - QnAMaker", Environment.NewLine)).Send("09")
.Send("luhan")
.AssertReply(activity =>
{
Expand All @@ -160,7 +160,7 @@ public async Task Actions_09EditActions()
{
await BuildTestFlow(getFolderPath("ActionsSample"))
.SendConversationUpdate()
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}", Environment.NewLine)).Send("10")
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}13 - QnAMaker", Environment.NewLine)).Send("10")
.AssertReply("Hello, I'm Zoidberg. What is your name?")
.Send("luhan")
.AssertReply("Hello luhan, nice to talk to you!")
Expand All @@ -173,7 +173,7 @@ public async Task Actions_10ReplaceDialog()
{
await BuildTestFlow(getFolderPath("ActionsSample"))
.SendConversationUpdate()
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}", Environment.NewLine)).Send("11")
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}13 - QnAMaker", Environment.NewLine)).Send("11")
.AssertReply("Hello, I'm Zoidberg. What is your name?")
.Send("luhan")
.AssertReply("Hello luhan, nice to talk to you! Please either enter 'joke' or 'fortune' to replace the dialog you want.")
Expand All @@ -193,7 +193,7 @@ public async Task Actions_11EmitEvent()
{
await BuildTestFlow(getFolderPath("ActionsSample"))
.SendConversationUpdate()
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}", Environment.NewLine)).Send("12")
.AssertReply(String.Format("I can show you examples on how to use actions. Enter the number next to the entity that you with to see in action.{0}01 - Actions{0}02 - EndTurn{0}03 - IfCondiftion{0}04 - EditArray, Foreach{0}05 - EndDialog{0}06 - HttpRequest{0}07 - SwitchCondition{0}08 - RepeatDialog{0}09 - TraceAndLog{0}10 - EditActions{0}11 - ReplaceDialog{0}12 - EmitEvent{0}13 - QnAMaker", Environment.NewLine)).Send("12")
.AssertReply("Say moo to get a response, say emit to emit a event.")
.Send("moo")
.AssertReply("Yippee ki-yay!")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"$type": "Microsoft.AdaptiveDialog",
"$designer": {
"name": "EmitAnEvent",
"description": "This is to emit an event.",
"id": "645228"
},
"autoEndDialog": "false",
"defaultResultProperty": "dialog.result",
"recognizer": {
"$type": "Microsoft.RegexRecognizer",
"intents": [
{
"$type": "Microsoft.IntentPattern",
"intent": "EmitEvent",
"pattern": "emit"
},
{
"$type": "Microsoft.IntentPattern",
"intent": "CowboyIntent",
"pattern": "moo"
}
]
},
"triggers": [
{
"$type": "Microsoft.OnIntent",
"intent": "EmitEvent",
"actions": [
{
"$type": "Microsoft.EmitEvent",
"eventName": "CustomEvent",
"bubbleEvent": true
}
]
},
{
"$type": "Microsoft.OnIntent",
"intent": "CowboyIntent",
"actions": [
{
"$type": "Microsoft.SendActivity",
"activity": "Yippee ki-yay!"
}
]
},
{
"$type": "Microsoft.OnBeginDialog",
"$designer": {
"id": "140685"
},
"actions": [
{
"$type": "Microsoft.SendActivity",
"$designer": {
"id": "576334",
"name": "Send a response"
},
"activity": "[bfdactivity-576334]"
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"id": "701087"
},
"autoEndDialog": true,
"defaultResultProperty": "dialog.result",
"triggers": [
{
"$type": "Microsoft.OnCustomEvent",
Expand All @@ -23,67 +24,16 @@
"$designer": {
"id": "360314"
},

"actions": [
{
"$type": "Microsoft.SendActivity",
"$designer": {
"id": "879639"
},
"activity": "[bfdactivity-879639]"
},
{
"$type": "Microsoft.BeginDialog",
"$designer": {
"id": "293316"
},
"Dialog": {
"$type": "Microsoft.AdaptiveDialog",
"autoEndDialog": false,
"recognizer": {
"$type": "Microsoft.RegexRecognizer",
"intents": [
{

"$type": "Microsoft.IntentPattern",
"intent": "EmitEvent",
"pattern": "emit"
},
{

"$type": "Microsoft.IntentPattern",
"intent": "CowboyIntent",
"pattern": "moo"
}
]
},
"triggers": [
{
"$type": "Microsoft.OnIntent",
"intent": "EmitEvent",
"actions": [
{
"$type": "Microsoft.EmitEvent",
"EventName": "CustomEvent",
"BubbleEvent": true
}
]
},
{
"$type": "Microsoft.OnIntent",
"intent": "CowboyIntent",
"actions": [
{
"$type": "Microsoft.SendActivity",
"activity": "Yippee ki-yay!"
}
]
}
]
}
"dialog": "EmitAnEvent"
}
]
}
],
"$schema": "../../app.schema"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"$type": "Microsoft.AdaptiveDialog",
"$designer": {
"id": "892616"
"id": "892616",
"name": "Actions"
},
"autoEndDialog": false,
"defaultResultProperty": "dialog.result",
Expand Down Expand Up @@ -68,6 +69,10 @@
"intent": "EmitEvent",
"pattern": "EmitEvent|12"
},
{
"intent": "QnAMaker",
"pattern": "QnAMaker|13"
},
{
"$type": "Microsoft.IntentPattern",
"intent": "CancelIntent",
Expand Down Expand Up @@ -258,7 +263,7 @@
"$designer": {
"id": "347762"
},
"activity": "[bfdactivity-347762]"
"activity": "[bfdactivity-640616]"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$type": "Microsoft.AdaptiveDialog",
"$designer": {
"name": "QnAMakerAction",
"description": "An action to call QnA knowledge base.",
"id": "901199"
},
"autoEndDialog": "true",
"defaultResultProperty": "dialog.result",
"triggers": [
{
"$type": "Microsoft.OnBeginDialog",
"$designer": {
"name": "BeginDialog"
},
"actions": [
{
"$type": "Microsoft.QnAMakerDialog",
"$designer": {
"id": "878804",
"name": "Connect to QnA Knowledgebase"
},
"knowledgeBaseId": "settings.qna.knowledgebaseid",
"endpointKey": "settings.qna.endpointkey",
"hostname": "settings.qna.hostname",
"noAnswer": "Sorry, I did not find an answer.",
"threshold": 0.3,
"activeLearningCardTitle": "Did you mean:",
"cardNoMatchText": "None of the above.",
"cardNoMatchResponse": "Thanks for the feedback."
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
09 - TraceAndLog
10 - EditActions
11 - ReplaceDialog
12 - EmitEvent```
12 - EmitEvent
13 - QnAMaker```

# bfdactivity-666135
-Here are the index and values in the array.
Expand All @@ -22,9 +23,6 @@
# bfdactivity-644042
-Hello {user.name}, nice to talk to you!

# bfdactivity-879639
-Say moo to get a response, say emit to emit a event.

# bfdactivity-604381
-Hello {user.name}, nice to talk to you!

Expand Down Expand Up @@ -76,17 +74,6 @@
# bfdactivity-286023
-To get to the other side!

# bfdactivity-166189
-Step 1

# bfdactivity-069635
-Step 2

# bfdactivity-851726
-Step 3

# bfdactivity-116995
-user.age is set to {user.age}

# bfdactivity-166131
-user.age is set to {user.age}
Expand Down Expand Up @@ -118,8 +105,8 @@
# bfdactivity-700082
-You select: 3

# bfdactivity-347762
-[help]

# bfdactivity-640616
-[help]

# bfdactivity-576334
- Say moo to get a response, say emit to emit a event.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ I can show you examples on how to use actions, You can enter number 01-04
# bfdactivity-068558
-[help]

# bfdactivity-587377
-[ShowImage(dialog.attachments[0].contentUrl, dialog.attachments[0].contentType)]

# bfdactivity-004212
-You select: {user.style}

Expand All @@ -55,12 +52,6 @@ I can show you examples on how to use actions, You can enter number 01-04
# bfdactivity-538962
-Hello {user.name}, nice to talk to you!

# bfdactivity-118486
-Hello {user.name}, nice to talk to you!

# bfdactivity-509484
-[help]

# bfdactivity-991558
-[ShowEmailSummary(user)]

Expand All @@ -73,6 +64,3 @@ I can show you examples on how to use actions, You can enter number 01-04
# bfdactivity-581197
-[help]

# bfdactivity-172545
- Welcome to Input Sample Bot.

Loading

0 comments on commit 3ee7283

Please sign in to comment.