diff --git a/libraries/Microsoft.Bot.Builder.AI.QnA/Models/FeedbackRecord.cs b/libraries/Microsoft.Bot.Builder.AI.QnA/Models/FeedbackRecord.cs index 8d6063c92..cd5382ab9 100644 --- a/libraries/Microsoft.Bot.Builder.AI.QnA/Models/FeedbackRecord.cs +++ b/libraries/Microsoft.Bot.Builder.AI.QnA/Models/FeedbackRecord.cs @@ -11,20 +11,29 @@ namespace Microsoft.Bot.Builder.AI.QnA public class FeedbackRecord { /// - /// User id. + /// Gets or sets user id. /// + /// + /// User id. + /// [JsonProperty("userId")] public string UserId { get; set; } /// - /// User question. + /// Gets or sets user question. /// + /// + /// User question. + /// [JsonProperty("userQuestion")] public string UserQuestion { get; set; } /// - /// QnA Id. + /// Gets or sets qnA Id. /// + /// + /// QnA Id. + /// [JsonProperty("qnaId")] public int QnaId { get; set; } } diff --git a/libraries/Microsoft.Bot.Builder.AI.QnA/QnAMakerDialog.cs b/libraries/Microsoft.Bot.Builder.AI.QnA/QnAMakerDialog.cs index f07c141d7..5f7a0e8d9 100644 --- a/libraries/Microsoft.Bot.Builder.AI.QnA/QnAMakerDialog.cs +++ b/libraries/Microsoft.Bot.Builder.AI.QnA/QnAMakerDialog.cs @@ -21,7 +21,7 @@ namespace Microsoft.Bot.Builder.AI.QnA { private QnAMaker qnamaker; - public QnAMakerDialog(string dialogId = null, QnAMaker qnamaker=null) + public QnAMakerDialog(string dialogId = null, QnAMaker qnamaker = null) : base(dialogId) { this.qnamaker = qnamaker; diff --git a/libraries/Microsoft.Bot.Builder.AI.QnA/Utils/GenerateAnswerUtils.cs b/libraries/Microsoft.Bot.Builder.AI.QnA/Utils/GenerateAnswerUtils.cs index 6b074e330..4ad787c89 100644 --- a/libraries/Microsoft.Bot.Builder.AI.QnA/Utils/GenerateAnswerUtils.cs +++ b/libraries/Microsoft.Bot.Builder.AI.QnA/Utils/GenerateAnswerUtils.cs @@ -42,6 +42,9 @@ namespace Microsoft.Bot.Builder.AI.QnA /// /// Gets or sets qnA Maker options. /// + /// + /// QnA Maker options. + /// public QnAMakerOptions Options { get; set; } /// diff --git a/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Clause.cs b/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Clause.cs index 4d7daab3d..2c81c5267 100644 --- a/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Clause.cs +++ b/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Clause.cs @@ -8,9 +8,10 @@ public class Clause : Expression { - private Dictionary anyBindings = new Dictionary(); internal bool Subsumed = false; + private Dictionary anyBindings = new Dictionary(); + internal Clause() : base(ExpressionType.And) { diff --git a/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Interfaces.cs b/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Interfaces.cs index 89b788974..58b73ed79 100644 --- a/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Interfaces.cs +++ b/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Interfaces.cs @@ -16,7 +16,7 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees /// Optionally rewrite a clause. /// /// Original clause. - /// + /// Optimized clause. Clause Optimize(Clause clause); } diff --git a/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Node.cs b/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Node.cs index 3ee0f34f6..a9fa72845 100644 --- a/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Node.cs +++ b/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Node.cs @@ -24,6 +24,15 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees private List _triggers = new List(); private List _specializations = new List(); + private enum Operation + { + None, + Found, + Added, + Removed, + Inserted + } + #if Count private static int _count = 0; #endif @@ -31,6 +40,9 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees /// /// Gets all of the most specific triggers that contain the in this node. /// + /// + /// All of the most specific triggers that contain the in this node. + /// public IReadOnlyList Triggers => _triggers; /// @@ -42,26 +54,41 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees /// then the second trigger would be in AllTriggers, but not Triggers because it /// is more general. /// + /// + /// All triggers that contain the in this node. + /// public IReadOnlyList AllTriggers => _allTriggers; /// /// Gets specialized children of this node. /// + /// + /// Specialized children of this node. + /// public IReadOnlyList Specializations => _specializations; /// /// Gets the logical conjunction this node represents. /// + /// + /// The logical conjunction this node represents. + /// public Clause Clause { get; } /// - /// Expression to evaluate for node. + /// Gets expression to evaluate for node. /// + /// + /// Expression to evaluate for node. + /// public Expression Expression { get; } /// - /// The tree this node is found in. + /// Gets the tree this node is found in. /// + /// + /// The tree this node is found in. + /// public TriggerTree Tree { get; } #if TraceTree @@ -120,6 +147,14 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees public void ToString(StringBuilder builder, int indent = 0) => Clause.ToString(builder, indent); + /// + /// Identify the relationship between two nodes. + /// + /// + /// Relationship between this node and the other. + public RelationshipType Relationship(Node other) + => Clause.Relationship(other.Clause, Tree.Comparers); + /// /// Return the most specific matches below this node. /// @@ -132,23 +167,6 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees return matches; } - /// - /// Identify the relationship between two nodes. - /// - /// - /// Relationship between this node and the other. - public RelationshipType Relationship(Node other) - => Clause.Relationship(other.Clause, Tree.Comparers); - - private enum Operation - { - None, - Found, - Added, - Removed, - Inserted - } - #pragma warning disable IDE0022 internal bool AddNode(Node triggerNode) { @@ -460,7 +478,6 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees foreach (var removal in removals) { // Don't need to add back because specialization already has them - _specializations.Remove(removal); #if TraceTree if (Node.ShowTrace) @@ -495,6 +512,7 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees if (!visited.Contains(this)) { visited.Add(this); + // Remove from allTriggers and triggers if (_allTriggers.Remove(trigger)) { diff --git a/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Quantifier.cs b/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Quantifier.cs index fc8fe088f..5c4d0e3ff 100644 --- a/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Quantifier.cs +++ b/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Quantifier.cs @@ -9,7 +9,8 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees /// /// Type of quantifier for expanding trigger expressions. /// - public enum QuantifierType { + public enum QuantifierType + { /// /// Within a clause, duplicate any predicate with variable for each possible binding. /// @@ -18,8 +19,8 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees /// /// Create a new clause for each possible binding of variable. /// - Any } -; + Any + } /// /// Quantifier for allowing runtime expansion of expressions. @@ -27,22 +28,31 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees public class Quantifier { /// - /// Name of variable that will be replaced. + /// Gets name of variable that will be replaced. /// + /// + /// Name of variable that will be replaced. + /// public string Variable { get; } /// - /// Type of quantifier. + /// Gets type of quantifier. /// + /// + /// Type of quantifier. + /// public QuantifierType Type { get; } /// - /// Possible bindings for quantifier. + /// Gets possible bindings for quantifier. /// + /// + /// Possible bindings for quantifier. + /// public IEnumerable Bindings { get; } /// - /// Create a quantifier. + /// Initializes a new instance of the class. /// /// Name of variable to replace. /// Type of quantifier. diff --git a/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Trigger.cs b/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Trigger.cs index 1c8dd48a3..279d7a0fa 100644 --- a/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Trigger.cs +++ b/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/Trigger.cs @@ -20,6 +20,7 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees private List _clauses; /// + /// Initializes a new instance of the class. /// Construct a trigger expression. /// /// Trigger tree that contains this trigger. @@ -49,13 +50,21 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees } /// - /// Action to take when trigger is true. + /// Gets action to take when trigger is true. /// + /// + /// Action to take when trigger is true. + /// public object Action { get; } /// - /// Expressions are converted into Disjunctive Normal Form where ! is pushed to the leaves and there is an implicit || between clauses and && within a clause. + /// Gets list of expressions converted into Disjunctive Normal Form where ! is pushed to the leaves and + /// there is an implicit || between clauses and && within a clause. /// + /// + /// List of expressions converted into Disjunctive Normal Form where ! is pushed to the leaves and + /// there is an implicit || between clauses and && within a clause. + /// public IReadOnlyList Clauses => _clauses; public override string ToString() @@ -102,6 +111,34 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees return result; } + protected void ToString(StringBuilder builder, int indent = 0) + { + builder.Append(' ', indent); + if (_clauses.Any()) + { + var first = true; + foreach (var clause in _clauses) + { + if (first) + { + first = false; + } + else + { + builder.AppendLine(); + builder.Append(' ', indent); + builder.Append("|| "); + } + + builder.Append(clause.ToString()); + } + } + else + { + builder.Append(""); + } + } + private RelationshipType Relationship(Trigger trigger, Trigger other, Dictionary comparers) { var soFar = RelationshipType.Incomparable; @@ -150,34 +187,6 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees return soFar; } - protected void ToString(StringBuilder builder, int indent = 0) - { - builder.Append(' ', indent); - if (_clauses.Any()) - { - var first = true; - foreach (var clause in _clauses) - { - if (first) - { - first = false; - } - else - { - builder.AppendLine(); - builder.Append(' ', indent); - builder.Append("|| "); - } - - builder.Append(clause.ToString()); - } - } - else - { - builder.Append(""); - } - } - private IEnumerable GenerateClauses(Expression expression) { switch (expression.Type) diff --git a/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/TriggerTree.cs b/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/TriggerTree.cs index b291e5d12..61995a54e 100644 --- a/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/TriggerTree.cs +++ b/libraries/Microsoft.Bot.Builder.AI.TriggerTrees/TriggerTree.cs @@ -45,16 +45,17 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees /// A trigger tree organizes evaluators according to generalization/specialization in order to make it easier to use rules. /// /// - /// A trigger expression generates true if the expression evaluated on a frame is true. - /// The expression itself consists of arbitrary boolean functions ("predicates") combined with && || !. + /// A trigger expression generates true if the expression evaluated on a frame is true. + /// The expression itself consists of arbitrary boolean functions ("predicates") combined with && || !. /// Most predicates are expressed over the frame passed in, but they can be anything--there are even ways of optimizing or comparing them. - /// By organizing evaluators into a tree (techinically a DAG) it becomes easier to use rules by reducing the coupling between rules. - /// For example if a rule applies if some predicate A is true, then another rule that applies if A && B are true is + /// By organizing evaluators into a tree (techinically a DAG) it becomes easier to use rules by reducing the coupling between rules. + /// For example if a rule applies if some predicate A is true, then another rule that applies if A && B are true is /// more specialized. If the second expression is true, then because we know of the relationship we can ignore the first /// rule--even though its expression is true. Without this kind of capability in order to add the second rule, you would - /// have to change the first to become A && !B. + /// have to change the first to become A && !B. /// - [DebuggerDisplay("{ToString()}"), DebuggerTypeProxy(typeof(Debugger))] + [DebuggerDisplay("{ToString()}")] + [DebuggerTypeProxy(typeof(Debugger))] public class TriggerTree { public List Optimizers = new List(); @@ -62,20 +63,6 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees public Node Root; public int TotalTriggers = 0; - private class Debugger - { - public string TreeString; - public List _optimizers; - public Dictionary _comparers; - - public Debugger(TriggerTree triggers) - { - TreeString = triggers.TreeToString(); - _optimizers = triggers.Optimizers; - _comparers = triggers.Comparers; - } - } - /// /// Mark a sub-expression as optional. /// @@ -195,17 +182,6 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees return builder.ToString(); } - private void TreeToString(StringBuilder builder, Node node, int indent) - { - node.ToString(builder, indent); - builder.Append($" [{node.Triggers.Count}]"); - builder.AppendLine(); - foreach (var child in node.Specializations) - { - TreeToString(builder, child, indent + 2); - } - } - public void GenerateGraph(string outPath) { using (var output = new StreamWriter(outPath)) @@ -217,6 +193,17 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees } } + private void TreeToString(StringBuilder builder, Node node, int indent) + { + node.ToString(builder, indent); + builder.Append($" [{node.Triggers.Count}]"); + builder.AppendLine(); + foreach (var child in node.Specializations) + { + TreeToString(builder, child, indent + 2); + } + } + private string NameNode(Node node) => '"' + node.ToString().Replace("\"", "\\\"") + '"'; private void GenerateGraph(StreamWriter output, Node node, int indent, HashSet visited) @@ -253,7 +240,7 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees /// /// Return the possible matches given the current state. /// - /// Frame to evaluate against. + /// State to evaluate against. /// Enumeration of possible matches. public IEnumerable Matches(object state) => Root.Matches(state); @@ -294,5 +281,19 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees return badNode; } + + private class Debugger + { + public string TreeString; + public List _optimizers; + public Dictionary _comparers; + + public Debugger(TriggerTree triggers) + { + TreeString = triggers.TreeToString(); + _optimizers = triggers.Optimizers; + _comparers = triggers.Comparers; + } + } } } diff --git a/libraries/Microsoft.Bot.Builder.Azure/AzureBlobTranscriptStore.cs b/libraries/Microsoft.Bot.Builder.Azure/AzureBlobTranscriptStore.cs index cb5c3b1e9..ea8d2a9d0 100644 --- a/libraries/Microsoft.Bot.Builder.Azure/AzureBlobTranscriptStore.cs +++ b/libraries/Microsoft.Bot.Builder.Azure/AzureBlobTranscriptStore.cs @@ -109,6 +109,7 @@ namespace Microsoft.Bot.Builder.Azure if (blob != null) { var originalActivity = JsonConvert.DeserializeObject(await blob.DownloadTextAsync().ConfigureAwait(false)); + // tombstone the original message var tombstonedActivity = new Activity() { diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/BaseInvokeDialog.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/BaseInvokeDialog.cs index 4a9efa10b..3abc21e6e 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/BaseInvokeDialog.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/BaseInvokeDialog.cs @@ -16,6 +16,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions { /// /// Action which calls another dialog. + /// public abstract class BaseInvokeDialog : DialogAction { public BaseInvokeDialog(string dialogIdToCall = null, string property = null, IDictionary bindingOptions = null) @@ -37,16 +38,25 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions /// /// Gets or sets configurable options for the dialog. /// + /// + /// Configurable options for the dialog. + /// public object Options { get; set; } = new JObject(); /// /// Gets or sets the dialog ID to call. /// + /// + /// The dialog ID to call. + /// public string DialogId { get; set; } /// - /// The property from memory to pass to the calling dialog and to set the return value to. + /// Gets or sets the property from memory to pass to the calling dialog and to set the return value to. /// + /// + /// The property from memory to pass to the calling dialog and to set the return value to. + /// public string Property { get diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/CancelAllDialogs.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/CancelAllDialogs.cs index 29eaa4b75..6bfe46be4 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/CancelAllDialogs.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/CancelAllDialogs.cs @@ -25,13 +25,19 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions } /// - /// Event name. + /// Gets or sets event name. /// + /// + /// Event name. + /// public string EventName { get; set; } /// - /// Event value. + /// Gets or sets event value. /// + /// + /// Event value. + /// public string EventValue { get; set; } protected override async Task OnRunCommandAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken)) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/DeleteProperty.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/DeleteProperty.cs index 6be55b2cc..68963c872 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/DeleteProperty.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/DeleteProperty.cs @@ -15,8 +15,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions public class DeleteProperty : DialogAction { /// - /// Property to path to remove Example: user.age will remove "age" from "user". + /// Gets or sets property to path to remove Example: user.age will remove "age" from "user". /// + /// + /// Property to path to remove Example: user.age will remove "age" from "user". + /// public string Property { get; set; } [JsonConstructor] diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EditActions.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EditActions.cs index 12dda91d7..3e5fbcb98 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EditActions.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EditActions.cs @@ -17,6 +17,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions /// /// Initializes a new instance of the class. /// + /// + /// [JsonConstructor] public EditActions([CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) : base() @@ -27,12 +29,18 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions /// /// Gets or sets the actions to be applied to the active action. /// + /// + /// The actions to be applied to the active action. + /// [JsonProperty("actions")] public List Actions { get; set; } = new List(); /// /// Gets or sets the type of change to appy to the active actions. /// + /// + /// The type of change to appy to the active actions. + /// [JsonProperty("changeType")] public ActionChangeType ChangeType { get; set; } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EditArray.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EditArray.cs index 5cc28b956..9c416ae84 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EditArray.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EditArray.cs @@ -63,6 +63,9 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions /// /// Gets or sets type of change being applied. /// + /// + /// Type of change being applied. + /// [JsonConverter(typeof(StringEnumConverter))] [JsonProperty("changeType")] public ArrayChangeType ChangeType { get; set; } @@ -74,7 +77,10 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions /// /// Gets or sets memory expression of the array to manipulate. - /// Edit + /// + /// + /// Memory expression of the array to manipulate. + /// Edit [JsonProperty("arrayProperty")] public string ArrayProperty { @@ -85,6 +91,9 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions /// /// Gets or sets the result of the action. /// + /// + /// The result of the action. + /// [JsonProperty("resultProperty")] public string ResultProperty { @@ -95,6 +104,9 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions /// /// Gets or sets the expression of the item to put onto the array. /// + /// + /// The expression of the item to put onto the array. + /// [JsonProperty("value")] public string Value { diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EndDialog.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EndDialog.cs index af0a5feaa..40343fc29 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EndDialog.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EndDialog.cs @@ -29,6 +29,9 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions /// /// Gets or sets the property to return as the result ending the dialog. /// + /// + /// The property to return as the result ending the dialog. + /// public string ResultProperty { get; set; } = "dialog.result"; protected override async Task OnRunCommandAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken)) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/ForEach.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/ForEach.cs index 065adbd07..a57923aa3 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/ForEach.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/ForEach.cs @@ -54,13 +54,6 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions return this.Actions; } - public class ForeachOptions - { - public Expression list { get; set; } - - public int offset { get; set; } - } - protected override async Task OnRunCommandAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken)) { if (options is CancellationToken) @@ -76,8 +69,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions if (options != null && options is ForeachOptions) { var opt = options as ForeachOptions; - listProperty = opt.list; - offset = opt.offset; + listProperty = opt.List; + offset = opt.Offset; } if (listProperty == null) @@ -107,8 +100,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions DialogId = this.Id, Options = new ForeachOptions() { - list = listProperty, - offset = offset + 1 + List = listProperty, + Offset = offset + 1 } }); sc.QueueChanges(changes); @@ -145,5 +138,12 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions return result; } + + public class ForeachOptions + { + public Expression List { get; set; } + + public int Offset { get; set; } + } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/ForEachPage.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/ForEachPage.cs index 556b7c727..23979ea00 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/ForEachPage.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/ForEachPage.cs @@ -22,6 +22,13 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions { private Expression listProperty; + [JsonConstructor] + public ForeachPage([CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) + : base() + { + this.RegisterSourceLocation(sourceFilePath, sourceLineNumber); + } + // Expression used to compute the list that should be enumerated. [JsonProperty("listProperty")] public string ListProperty @@ -41,11 +48,9 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions [JsonProperty("actions")] public List Actions { get; set; } = new List(); - [JsonConstructor] - public ForeachPage([CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) - : base() + public override List ListDependencies() { - this.RegisterSourceLocation(sourceFilePath, sourceLineNumber); + return this.Actions; } protected override async Task OnRunCommandAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken)) @@ -64,9 +69,9 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions if (options != null && options is ForeachPageOptions) { var opt = options as ForeachPageOptions; - listProperty = opt.list; - offset = opt.offset; - pageSize = opt.pageSize; + listProperty = opt.List; + offset = opt.Offset; + pageSize = opt.PageSize; } if (pageSize == 0) @@ -100,9 +105,9 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions DialogId = this.Id, Options = new ForeachPageOptions() { - list = listProperty, - offset = offset + pageSize, - pageSize = pageSize + List = listProperty, + Offset = offset + pageSize, + PageSize = pageSize } }); sc.QueueChanges(changes); @@ -117,6 +122,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions } } + protected override string OnComputeId() + { + return $"{nameof(Foreach)}({this.ListProperty})"; + } + private List GetPage(object list, int index, int pageSize) { List page = new List(); @@ -142,23 +152,13 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions return page; } - protected override string OnComputeId() - { - return $"{nameof(Foreach)}({this.ListProperty})"; - } - - public override List ListDependencies() - { - return this.Actions; - } - public class ForeachPageOptions { - public Expression list { get; set; } + public Expression List { get; set; } - public int offset { get; set; } + public int Offset { get; set; } - public int pageSize { get; set; } + public int PageSize { get; set; } } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/HttpRequest.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/HttpRequest.cs index 9d6d8eb16..9efbcb886 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/HttpRequest.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/HttpRequest.cs @@ -21,7 +21,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions /// public class HttpRequest : DialogAction { - private static readonly HttpClient client = new HttpClient(); + private static readonly HttpClient Client = new HttpClient(); + + [JsonConstructor] + public HttpRequest([CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) + : base() + { + this.RegisterSourceLocation(callerPath, callerLine); + } public enum ResponseTypes { @@ -55,13 +62,6 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions DELETE } - [JsonConstructor] - public HttpRequest([CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) - : base() - { - this.RegisterSourceLocation(callerPath, callerLine); - } - protected override string OnComputeId() { return $"HttpRequest[{Method} {Url}]"; @@ -84,8 +84,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions public ResponseTypes ResponseType { get; set; } = ResponseTypes.Json; /// - /// Property which is bidirectional property for input and output. Example: user.age will be passed in, and user.age will be set when the dialog completes. + /// Gets or sets bidirectional property for input and output. Example: user.age will be passed in, and user.age will be set when the dialog completes. /// + /// + /// Property for input and output. + /// public string Property { get @@ -162,7 +165,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions } // Single command running with a copy of the original data - client.DefaultRequestHeaders.Clear(); + Client.DefaultRequestHeaders.Clear(); JToken instanceBody = null; if (this.Body != null) @@ -186,7 +189,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions { foreach (var unit in instanceHeaders) { - client.DefaultRequestHeaders.Add( + Client.DefaultRequestHeaders.Add( await new TextTemplate(unit.Key).BindToData(dc.Context, dc.State), await new TextTemplate(unit.Value).BindToData(dc.Context, dc.State)); } @@ -199,11 +202,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions case HttpMethod.POST: if (instanceBody == null) { - response = await client.PostAsync(instanceUrl, null); + response = await Client.PostAsync(instanceUrl, null); } else { - response = await client.PostAsync(instanceUrl, new StringContent(instanceBody.ToString(), Encoding.UTF8, "application/json")); + response = await Client.PostAsync(instanceUrl, new StringContent(instanceBody.ToString(), Encoding.UTF8, "application/json")); } break; @@ -212,13 +215,13 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions if (instanceBody == null) { var request = new HttpRequestMessage(new System.Net.Http.HttpMethod("PATCH"), instanceUrl); - response = await client.SendAsync(request); + response = await Client.SendAsync(request); } else { var request = new HttpRequestMessage(new System.Net.Http.HttpMethod("PATCH"), instanceUrl); request.Content = new StringContent(instanceBody.ToString(), Encoding.UTF8, "application/json"); - response = await client.SendAsync(request); + response = await Client.SendAsync(request); } break; @@ -226,21 +229,21 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions case HttpMethod.PUT: if (instanceBody == null) { - response = await client.PutAsync(instanceUrl, null); + response = await Client.PutAsync(instanceUrl, null); } else { - response = await client.PutAsync(instanceUrl, new StringContent(instanceBody.ToString(), Encoding.UTF8, "application/json")); + response = await Client.PutAsync(instanceUrl, new StringContent(instanceBody.ToString(), Encoding.UTF8, "application/json")); } break; case HttpMethod.DELETE: - response = await client.DeleteAsync(instanceUrl); + response = await Client.DeleteAsync(instanceUrl); break; case HttpMethod.GET: - response = await client.GetAsync(instanceUrl); + response = await Client.GetAsync(instanceUrl); break; } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/IfCondition.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/IfCondition.cs index 79d1d83d4..63c16b7e0 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/IfCondition.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/IfCondition.cs @@ -22,13 +22,16 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions private Expression condition; /// - /// Condition expression against memory Example: "user.age > 18". + /// Gets or sets condition expression against memory. Example: "user.age > 18". /// + /// + /// Condition expression against memory. + /// [JsonProperty("condition")] public string Condition { get { return condition?.ToString(); } - set { lock(this) condition = (value != null) ? new ExpressionEngine().Parse(value) : null; } + set { lock (this) condition = value != null ? new ExpressionEngine().Parse(value) : null; } } [JsonProperty("actions")] @@ -44,6 +47,13 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions this.RegisterSourceLocation(sourceFilePath, sourceLineNumber); } + public override List ListDependencies() + { + var combined = new List(Actions); + combined.AddRange(ElseActions); + return combined; + } + protected override async Task OnRunCommandAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken)) { if (options is CancellationToken) @@ -94,12 +104,5 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions var idList = Actions.Select(s => s.Id); return $"{nameof(IfCondition)}({this.Condition}|{string.Join(",", idList)})"; } - - public override List ListDependencies() - { - var combined = new List(Actions); - combined.AddRange(ElseActions); - return combined; - } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/InitProperty.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/InitProperty.cs index ca0ae0634..5b1462093 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/InitProperty.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/InitProperty.cs @@ -24,8 +24,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions } /// - /// Property which is bidirectional property for input and output. Example: user.age will be passed in, and user.age will be set when the dialog completes. + /// Gets or sets bidirectional property for input and output. Example: user.age will be passed in, and user.age will be set when the dialog completes. /// + /// + /// Property for input and output. + /// public string Property { get @@ -41,8 +44,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions } /// - /// Type, either Array or Object. + /// Gets or sets type, either Array or Object. /// + /// + /// Type, either Array or Object. + /// public string Type { get; set; } protected override async Task OnRunCommandAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken)) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/LogAction.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/LogAction.cs index 4ae8d7f8a..3d2da435d 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/LogAction.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/LogAction.cs @@ -15,18 +15,6 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions /// public class LogAction : DialogAction { - /// - /// LG expression to log. - /// - [JsonProperty("text")] - public ITextTemplate Text { get; set; } - - /// - /// If set to true a TraceActivity will be sent in addition to console log. - /// - [JsonProperty("traceActivity")] - public bool TraceActivity { get; set; } = false; - [JsonConstructor] public LogAction(string text = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) { @@ -37,6 +25,24 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions } } + /// + /// Gets or sets lG expression to log. + /// + /// + /// LG expression to log. + /// + [JsonProperty("text")] + public ITextTemplate Text { get; set; } + + /// + /// Gets or sets a value indicating whether a TraceActivity will be sent in addition to console log. + /// + /// + /// Whether a TraceActivity will be sent in addition to console log. + /// + [JsonProperty("traceActivity")] + public bool TraceActivity { get; set; } = false; + protected override async Task OnRunCommandAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken)) { var text = await Text.BindToData(dc.Context, dc.State).ConfigureAwait(false); diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/SendActivity.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/SendActivity.cs index a1c2d37a1..faba0b550 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/SendActivity.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/SendActivity.cs @@ -15,11 +15,6 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions /// public class SendActivity : DialogAction { - /// - /// Template for the activity. - /// - public ITemplate Activity { get; set; } - [JsonConstructor] public SendActivity(string text = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) { @@ -27,6 +22,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions this.Activity = new ActivityTemplate(text ?? string.Empty); } + /// + /// Gets or sets template for the activity. + /// + /// + /// Template for the activity. + /// + public ITemplate Activity { get; set; } + public SendActivity(Activity activity, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) { this.RegisterSourceLocation(callerPath, callerLine); @@ -57,7 +60,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions private static string Ellipsis(string text, int length) { - if (text.Length <= length) return text; + if (text.Length <= length) { return text; } int pos = text.IndexOf(" ", length); if (pos >= 0) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/SetProperty.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/SetProperty.cs index a6ac65408..00aab917d 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/SetProperty.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/SetProperty.cs @@ -28,8 +28,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions } /// - /// Value expression. + /// Gets or sets value expression. /// + /// + /// Value expression. + /// [JsonProperty("value")] public string Value { @@ -38,8 +41,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions } /// - /// Property to put the value in. + /// Gets or sets property to put the value in. /// + /// + /// Property to put the value in. + /// [JsonProperty("property")] public string Property { diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/SwitchCondition.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/SwitchCondition.cs index aaf680cff..e33cf772f 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/SwitchCondition.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/SwitchCondition.cs @@ -15,57 +15,6 @@ using Newtonsoft.Json; namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions { - public class Case - { - public Case(string value = null, IEnumerable actions = null) - { - this.Value = value; - this.Actions = actions?.ToList() ?? this.Actions; - } - - /// - /// Value expression to be compared against condition. - /// - [JsonProperty("value")] - public string Value { get; set; } - - /// - /// Set of actions to be executed given that the condition of the switch matches the value of this case. - /// - [JsonProperty("actions")] - public List Actions { get; set; } = new List(); - - /// - /// Creates an expression that returns the value in its primitive type. Still - /// assumes that switch case values are compile time constants and not expressions - /// that can be evaluated against state. - /// - /// An expression that reflects the constant case value. - public Expression CreateValueExpression() - { - Expression expression = null; - - if (Int64.TryParse(Value, out Int64 i)) - { - expression = Expression.ConstantExpression(i); - } - else if (float.TryParse(Value, out float f)) - { - expression = Expression.ConstantExpression(f); - } - else if (bool.TryParse(Value, out bool b)) - { - expression = Expression.ConstantExpression(b); - } - else - { - expression = Expression.ConstantExpression(Value); - } - - return expression; - } - } - /// /// Conditional branch with multiple cases. /// @@ -75,9 +24,19 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions private Expression condition; + [JsonConstructor] + public SwitchCondition([CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) + : base() + { + this.RegisterSourceLocation(callerPath, callerLine); + } + /// - /// Condition expression against memory Example: "user.age > 18". + /// Gets or sets condition expression against memory Example: "user.age > 18". /// + /// + /// Condition expression against memory Example: "user.age > 18". + /// [JsonProperty("condition")] public string Condition { @@ -91,17 +50,13 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions public List Cases = new List(); /// - /// Default case. + /// Gets or sets default case. /// + /// + /// Default case. + /// public List Default { get; set; } = new List(); - [JsonConstructor] - public SwitchCondition([CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) - : base() - { - this.RegisterSourceLocation(callerPath, callerLine); - } - protected override async Task OnRunCommandAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken)) { if (options is CancellationToken) @@ -195,4 +150,61 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions return dialogs; } } + + public class Case + { + public Case(string value = null, IEnumerable actions = null) + { + this.Value = value; + this.Actions = actions?.ToList() ?? this.Actions; + } + + /// + /// Gets or sets value expression to be compared against condition. + /// + /// + /// Value expression to be compared against condition. + /// + [JsonProperty("value")] + public string Value { get; set; } + + /// + /// Gets or sets set of actions to be executed given that the condition of the switch matches the value of this case. + /// + /// + /// Set of actions to be executed given that the condition of the switch matches the value of this case. + /// + [JsonProperty("actions")] + public List Actions { get; set; } = new List(); + + /// + /// Creates an expression that returns the value in its primitive type. Still + /// assumes that switch case values are compile time constants and not expressions + /// that can be evaluated against state. + /// + /// An expression that reflects the constant case value. + public Expression CreateValueExpression() + { + Expression expression = null; + + if (Int64.TryParse(Value, out Int64 i)) + { + expression = Expression.ConstantExpression(i); + } + else if (float.TryParse(Value, out float f)) + { + expression = Expression.ConstantExpression(f); + } + else if (bool.TryParse(Value, out bool b)) + { + expression = Expression.ConstantExpression(b); + } + else + { + expression = Expression.ConstantExpression(Value); + } + + return expression; + } + } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/TraceActivity.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/TraceActivity.cs index c1cadbdec..5dd19001b 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/TraceActivity.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/TraceActivity.cs @@ -16,27 +16,36 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Actions /// public class TraceActivity : DialogAction { - /// - /// Name of the trace activity. - /// - public string Name { get; set; } - - /// - /// Value type of the trace activity. - /// - public string ValueType { get; set; } - - /// - /// Property binding to memory to send as the value. - /// - public string Value { get; set; } - [JsonConstructor] public TraceActivity([CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) { this.RegisterSourceLocation(callerPath, callerLine); } + /// + /// Gets or sets name of the trace activity. + /// + /// + /// Name of the trace activity. + /// + public string Name { get; set; } + + /// + /// Gets or sets value type of the trace activity. + /// + /// + /// Value type of the trace activity. + /// + public string ValueType { get; set; } + + /// + /// Gets or sets property binding to memory to send as the value. + /// + /// + /// Property binding to memory to send as the value. + /// + public string Value { get; set; } + protected override async Task OnRunCommandAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken)) { if (options is CancellationToken) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/AdaptiveDialog.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/AdaptiveDialog.cs index 15c2bf632..8db4d403d 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/AdaptiveDialog.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/AdaptiveDialog.cs @@ -35,37 +35,55 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive public IStatePropertyAccessor> UserState { get; set; } /// - /// Recognizer for processing incoming user input. + /// Gets or sets recognizer for processing incoming user input. /// + /// + /// Recognizer for processing incoming user input. + /// public IRecognizer Recognizer { get; set; } /// - /// Language Generator override. + /// Gets or sets language Generator override. /// + /// + /// Language Generator override. + /// public ILanguageGenerator Generator { get; set; } /// - /// Rules for handling events to dynamic modifying the executing plan. + /// Gets or sets rules for handling events to dynamic modifying the executing plan. /// + /// + /// Rules for handling events to dynamic modifying the executing plan. + /// public virtual List Events { get; set; } = new List(); /// - /// Gets or sets the policty to Automatically end the dialog when there are no actions to execute. + /// Gets or sets a value indicating whether gets or sets the policty to Automatically end the dialog when there are no actions to execute. /// /// /// If true, when there are no actions to execute the current dialog will end /// If false, when there are no actions to execute the current dialog will simply end the turn and still be active. /// + /// + /// The policty to Automatically end the dialog when there are no actions to execute. + /// public bool AutoEndDialog { get; set; } = true; /// /// Gets or sets the selector for picking the possible events to execute. /// + /// + /// The selector for picking the possible events to execute. + /// public IEventSelector Selector { get; set; } /// /// Gets or sets the property to return as the result when the dialog ends when there are no more Actions and AutoEndDialog = true. /// + /// + /// The property to return as the result when the dialog ends when there are no more Actions and AutoEndDialog = true. + /// public string DefaultResultProperty { get; set; } = "dialog.result"; public override IBotTelemetryClient TelemetryClient @@ -440,6 +458,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive if (Recognizer != null) { var result = await Recognizer.RecognizeAsync(context, cancellationToken).ConfigureAwait(false); + // only allow one intent var topIntent = result.GetTopScoringIntent(); result.Intents.Clear(); diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnActivity.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnActivity.cs index 5fb65df69..a1f3bc756 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnActivity.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnActivity.cs @@ -17,21 +17,26 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events public class OnActivity : OnDialogEvent { [JsonConstructor] - public OnActivity(string type=null, List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) - : base(events: new List() - { - AdaptiveEvents.ActivityReceived - }, - actions: actions, - constraint: constraint, - callerPath: callerPath, callerLine: callerLine) + public OnActivity(string type = null, List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) + : base( + events: new List() + { + AdaptiveEvents.ActivityReceived + }, + actions: actions, + constraint: constraint, + callerPath: callerPath, + callerLine: callerLine) { Type = type; } /// - /// ActivityType. + /// Gets or sets activityType. /// + /// + /// ActivityType. + /// [JsonProperty("type")] public string Type { get; set; } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnBeginDialog.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnBeginDialog.cs index f1271e4f1..f32b46944 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnBeginDialog.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnBeginDialog.cs @@ -15,13 +15,15 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events { [JsonConstructor] public OnBeginDialog(List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) - : base(events: new List() - { + : base( + events: new List() + { AdaptiveEvents.BeginDialog - }, - actions: actions, - constraint: constraint, - callerPath: callerPath, callerLine: callerLine) + }, + actions: actions, + constraint: constraint, + callerPath: callerPath, + callerLine: callerLine) { } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnConversationUpdateActivity.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnConversationUpdateActivity.cs index dfe711a77..de0ce8c30 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnConversationUpdateActivity.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnConversationUpdateActivity.cs @@ -14,7 +14,9 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events public class OnConversationUpdateActivity : OnActivity { [JsonConstructor] - public OnConversationUpdateActivity(List actions = null, string constraint= null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) - : base(type: ActivityTypes.ConversationUpdate, actions: actions, constraint: constraint, callerPath: callerPath, callerLine: callerLine) { } + public OnConversationUpdateActivity(List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) + : base(type: ActivityTypes.ConversationUpdate, actions: actions, constraint: constraint, callerPath: callerPath, callerLine: callerLine) + { + } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnDialogEvent.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnDialogEvent.cs index 6374583f2..493a2c649 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnDialogEvent.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnDialogEvent.cs @@ -13,11 +13,6 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events /// public class OnDialogEvent : OnEvent { - /// - /// List of events to filter. - /// - public List Events { get; set; } - [JsonConstructor] public OnDialogEvent(List events = null, List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) : base(constraint: constraint, actions: actions, callerPath: callerPath, callerLine: callerLine) @@ -26,6 +21,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events this.Actions = actions ?? new List(); } + /// + /// Gets or sets list of events to filter. + /// + /// + /// List of events to filter. + /// + public List Events { get; set; } + protected override ActionChangeList OnCreateChangeList(SequenceContext planning, object dialogOptions = null) { var changeList = new ActionChangeList() diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnEndOfConversationActivity.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnEndOfConversationActivity.cs index b87e9ee5c..64123d417 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnEndOfConversationActivity.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnEndOfConversationActivity.cs @@ -14,7 +14,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events public class OnEndOfConversationActivity : OnActivity { [JsonConstructor] - public OnEndOfConversationActivity(List actions = null, string constraint= null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) + public OnEndOfConversationActivity(List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) : base(type: ActivityTypes.EndOfConversation, actions: actions, constraint: constraint, callerPath: callerPath, callerLine: callerLine) { } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnEvent.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnEvent.cs index fbbeacad8..d02579258 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnEvent.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnEvent.cs @@ -40,12 +40,18 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events /// /// Gets or sets the constraint to apply to the rule (OPTIONAL). /// + /// + /// The constraint to apply to the rule (OPTIONAL). + /// [JsonProperty("constraint")] public string Constraint { get; set; } /// /// Gets or sets the actions to add to the plan when the rule constraints are met. /// + /// + /// The actions to add to the plan when the rule constraints are met. + /// [JsonProperty("actions")] public List Actions { get; set; } = new List(); diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnEventActivity.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnEventActivity.cs index fe3c715e4..0371a97af 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnEventActivity.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnEventActivity.cs @@ -14,7 +14,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events public class OnEventActivity : OnActivity { [JsonConstructor] - public OnEventActivity(List actions = null, string constraint= null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) + public OnEventActivity(List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) : base(type: ActivityTypes.Event, actions: actions, constraint: constraint, callerPath: callerPath, callerLine: callerLine) { } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnHandoffActivity.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnHandoffActivity.cs index 08ffef2dc..9d867a011 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnHandoffActivity.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnHandoffActivity.cs @@ -14,7 +14,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events public class OnHandoffActivity : OnActivity { [JsonConstructor] - public OnHandoffActivity(List actions = null, string constraint= null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) + public OnHandoffActivity(List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) : base(type: ActivityTypes.Handoff, actions: actions, constraint: constraint, callerPath: callerPath, callerLine: callerLine) { } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnIntent.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnIntent.cs index 9537d185a..116065c49 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnIntent.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnIntent.cs @@ -31,12 +31,18 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events /// /// Gets or sets intent to match on. /// + /// + /// Intent to match on. + /// [JsonProperty("intent")] public string Intent { get; set; } /// /// Gets or sets entities which must be recognized for this rule to trigger. /// + /// + /// Entities which must be recognized for this rule to trigger. + /// [JsonProperty("entities")] public List Entities { get; set; } @@ -74,7 +80,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events Turn = new Dictionary() { - { "recognized" , JObject.FromObject(new + { + "recognized" , JObject.FromObject(new { text = recognizerResult.Text, alteredText = recognizerResult.AlteredText, diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnInvokeActivity.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnInvokeActivity.cs index a238d5e89..bbce840e5 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnInvokeActivity.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnInvokeActivity.cs @@ -14,7 +14,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events public class OnInvokeActivity : OnActivity { [JsonConstructor] - public OnInvokeActivity(List actions = null, string constraint= null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) + public OnInvokeActivity(List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) : base(type: ActivityTypes.Invoke, actions: actions, constraint: constraint, callerPath: callerPath, callerLine: callerLine) { } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageActivity.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageActivity.cs index 436517359..3e916ee70 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageActivity.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageActivity.cs @@ -14,7 +14,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events public class OnMessageActivity : OnActivity { [JsonConstructor] - public OnMessageActivity(List actions = null, string constraint= null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) + public OnMessageActivity(List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) : base(type: ActivityTypes.Message, actions: actions, constraint: constraint, callerPath: callerPath, callerLine: callerLine) { } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageDeleteActivity.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageDeleteActivity.cs index a20d6fd9c..9bb7217f1 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageDeleteActivity.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageDeleteActivity.cs @@ -14,7 +14,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events public class OnMessageDeleteActivity : OnActivity { [JsonConstructor] - public OnMessageDeleteActivity(List actions = null, string constraint= null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) + public OnMessageDeleteActivity(List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) : base(type: ActivityTypes.MessageDelete, actions: actions, constraint: constraint, callerPath: callerPath, callerLine: callerLine) { } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageReactionActivity.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageReactionActivity.cs index 3192d24be..80104ba8e 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageReactionActivity.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageReactionActivity.cs @@ -14,7 +14,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events public class OnMessageReactionActivity : OnActivity { [JsonConstructor] - public OnMessageReactionActivity(List actions = null, string constraint= null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) + public OnMessageReactionActivity(List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) : base(type: ActivityTypes.MessageReaction, actions: actions, constraint: constraint, callerPath: callerPath, callerLine: callerLine) { } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageUpdateActivity.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageUpdateActivity.cs index f3eb736f3..6f96b6620 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageUpdateActivity.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnMessageUpdateActivity.cs @@ -14,7 +14,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events public class OnMessageUpdateActivity : OnActivity { [JsonConstructor] - public OnMessageUpdateActivity(List actions = null, string constraint= null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) + public OnMessageUpdateActivity(List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) : base(type: ActivityTypes.MessageUpdate, actions: actions, constraint: constraint, callerPath: callerPath, callerLine: callerLine) { } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnTypingActivity.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnTypingActivity.cs index 048d7d826..35e175214 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnTypingActivity.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Events/OnTypingActivity.cs @@ -14,7 +14,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Events public class OnTypingActivity : OnActivity { [JsonConstructor] - public OnTypingActivity(List actions = null, string constraint= null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) + public OnTypingActivity(List actions = null, string constraint = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) : base(type: ActivityTypes.Typing, actions: actions, constraint: constraint, callerPath: callerPath, callerLine: callerLine) { } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/IOnEvent.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/IOnEvent.cs index 351d62095..aac07446a 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/IOnEvent.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/IOnEvent.cs @@ -24,8 +24,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive Task> ExecuteAsync(SequenceContext context); /// - /// Actions to add to the plan when the rule is activated. + /// Gets actions to add to the plan when the rule is activated. /// + /// + /// Actions to add to the plan when the rule is activated. + /// List Actions { get; } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/ChoiceInput.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/ChoiceInput.cs index c341d64b0..ceb0f5abc 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/ChoiceInput.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/ChoiceInput.cs @@ -52,38 +52,59 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Input }; /// - /// List of choices to present to user. + /// Gets or sets list of choices to present to user. /// + /// + /// List of choices to present to user. + /// public List Choices { get; set; } /// - /// Expression collection of choices to present o user. + /// Gets or sets expression collection of choices to present o user. /// + /// + /// Expression collection of choices to present o user. + /// public string ChoicesProperty { get; set; } /// - /// ListStyle to use to render the choices. + /// Gets or sets listStyle to use to render the choices. /// + /// + /// ListStyle to use to render the choices. + /// public ListStyle Style { get; set; } = ListStyle.Auto; /// - /// DefaultLocale. + /// Gets or sets defaultLocale. /// + /// + /// DefaultLocale. + /// public string DefaultLocale { get; set; } = null; /// - /// Control the format of the response (value or the index of the choice). + /// Gets or sets control the format of the response (value or the index of the choice). /// + /// + /// Control the format of the response (value or the index of the choice). + /// public ChoiceOutputFormat OutputFormat { get; set; } = ChoiceOutputFormat.Value; /// - /// ChoiceOptions controls display options for customizing language. + /// Gets or sets choiceOptions controls display options for customizing language. /// + /// + /// ChoiceOptions controls display options for customizing language. + /// public ChoiceFactoryOptions ChoiceOptions { get; set; } = null; /// - /// Customize how to use the choices to recognize the response from the user. + /// Gets or sets customize how to use the choices to recognize the response from the user. /// + /// + /// Customize how to use the choices to recognize the response from the user. + /// public FindChoicesOptions RecognizerOptions { get; set; } = null; public ChoiceInput([CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/InputDialog.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/InputDialog.cs index 87993ef66..c17ae67fb 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/InputDialog.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/InputDialog.cs @@ -55,8 +55,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Input public AllowInterruptions AllowInterruptions { get; set; } = AllowInterruptions.NotRecognized; /// - /// Initial value for the prompt. + /// Gets or sets initial value for the prompt. /// + /// + /// Initial value for the prompt. + /// [JsonProperty("value")] public string Value { @@ -65,30 +68,45 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Input } /// - /// Activity to send to the user. + /// Gets or sets activity to send to the user. /// + /// + /// Activity to send to the user. + /// public ITemplate Prompt { get; set; } /// - /// Activity template for retrying prompt. + /// Gets or sets activity template for retrying prompt. /// + /// + /// Activity template for retrying prompt. + /// public ITemplate UnrecognizedPrompt { get; set; } /// - /// Activity template to send to the user whenever the value provided is invalid. + /// Gets or sets activity template to send to the user whenever the value provided is invalid. /// + /// + /// Activity template to send to the user whenever the value provided is invalid. + /// public ITemplate InvalidPrompt { get; set; } public List Validations { get; set; } = new List(); /// - /// Maximum number of times to ask the user for this value before the dilog gives up. + /// Gets or sets maximum number of times to ask the user for this value before the dilog gives up. /// + /// + /// Maximum number of times to ask the user for this value before the dilog gives up. + /// public int? MaxTurnCount { get; set; } /// - /// Default value for the input dialog. + /// Gets or sets default value for the input dialog. /// + /// + /// Default value for the input dialog. + /// public string DefaultValue { get { return defaultValue?.ToString(); } @@ -96,8 +114,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Input } /// - /// The property from memory to pass to the calling dialog and to set the return value to. + /// Gets or sets the property from memory to pass to the calling dialog and to set the return value to. /// + /// + /// The property from memory to pass to the calling dialog and to set the return value to. + /// public string Property { get diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/OAuthInput.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/OAuthInput.cs index 47293447c..ee50fb12d 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/OAuthInput.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/OAuthInput.cs @@ -49,8 +49,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Input public int Timeout { get; set; } = 900000; /// - /// The property from memory to pass to the calling dialog and to set the return value to. + /// Gets or sets the property from memory to pass to the calling dialog and to set the return value to. /// + /// + /// The property from memory to pass to the calling dialog and to set the return value to. + /// public string Property { get diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/MultiLanguageRecognizer.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/MultiLanguageRecognizer.cs index c97f7c546..7bd3db784 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/MultiLanguageRecognizer.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/MultiLanguageRecognizer.cs @@ -14,14 +14,20 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Recognizers public class MultiLanguageRecognizer : IRecognizer { /// - /// Policy for languages fallback. + /// Gets or sets policy for languages fallback. /// + /// + /// Policy for languages fallback. + /// [JsonProperty("languagePolicy")] public ILanguagePolicy LanguagePolicy { get; set; } = new LanguagePolicy(); /// - /// Map of languages -> IRecognizer. + /// Gets or sets map of languages -> IRecognizer. /// + /// + /// Map of languages -> IRecognizer. + /// [JsonProperty("recognizers")] public IDictionary Recognizers { get; set; } = new Dictionary(); diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/RegexRecognizer.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/RegexRecognizer.cs index f1c033d9c..71db33821 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/RegexRecognizer.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/RegexRecognizer.cs @@ -22,8 +22,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Recognizers private Dictionary patterns = new Dictionary(); /// - /// Dictionary of patterns -> Intent names. + /// Gets or sets dictionary of patterns -> Intent names. /// + /// + /// Dictionary of patterns -> Intent names. + /// [JsonProperty("intents")] public Dictionary Intents { get; set; } = new Dictionary(); diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/ConditionalSelector.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/ConditionalSelector.cs index bb9e7194c..aade4766a 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/ConditionalSelector.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/ConditionalSelector.cs @@ -19,8 +19,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Selectors private Expression condition; /// - /// Expression that determines which selector to use. + /// Gets or sets expression that determines which selector to use. /// + /// + /// Expression that determines which selector to use. + /// public string Condition { get { return condition?.ToString(); } @@ -28,13 +31,19 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Selectors } /// - /// Selector if is true. + /// Gets or sets selector if is true. /// + /// + /// Selector if is true. + /// public IEventSelector IfTrue { get; set; } /// - /// Selector if is false. + /// Gets or sets selector if is false. /// + /// + /// Selector if is false. + /// public IEventSelector IfFalse { get; set; } public void Initialize(IEnumerable rules, bool evaluate = true) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/MostSpecificSelector.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/MostSpecificSelector.cs index 170127994..d1f14d9ff 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/MostSpecificSelector.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/MostSpecificSelector.cs @@ -16,8 +16,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Selectors private readonly TriggerTree _tree = new TriggerTree(); /// - /// Optional rule selector to use when more than one most specific rule is true. + /// Gets or sets optional rule selector to use when more than one most specific rule is true. /// + /// + /// Optional rule selector to use when more than one most specific rule is true. + /// public IEventSelector Selector { get; set; } public void Initialize(IEnumerable rules, bool evaluate) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/RandomSelector.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/RandomSelector.cs index 693e30c96..1b7de5df5 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/RandomSelector.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/RandomSelector.cs @@ -20,9 +20,12 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Selectors private IExpressionParser _parser = new ExpressionEngine(); /// - /// Optional seed for random number generator. + /// Gets or sets optional seed for random number generator. /// /// If not specified a random seed will be used. + /// + /// Optional seed for random number generator. + /// public int Seed { get => _seed; diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/SequenceContext.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/SequenceContext.cs index e80753071..59b7e1e10 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/SequenceContext.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/SequenceContext.cs @@ -23,13 +23,19 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive public AdaptiveDialogState Plans { get; private set; } /// + /// Gets or sets list of actions being executed. + /// + /// /// List of actions being executed. - /// + /// public List Actions { get; set; } - + /// - /// List of changes that are queued to be applied. + /// Gets list of changes that are queued to be applied. /// + /// + /// List of changes that are queued to be applied. + /// public List Changes { get { return this.Context.TurnState.Get>(changeKey); } @@ -340,6 +346,9 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive /// /// Gets or sets turn state associated with the plan change list (it will be applied to turn state when plan is applied). /// + /// + /// Turn state associated with the plan change list (it will be applied to turn state when plan is applied). + /// [JsonProperty(PropertyName = "turn")] public Dictionary Turn { get; set; } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Composition/Recognizers/EntityRecognizerSet.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Composition/Recognizers/EntityRecognizerSet.cs index 9839e71c3..cee87b4f5 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Composition/Recognizers/EntityRecognizerSet.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Composition/Recognizers/EntityRecognizerSet.cs @@ -14,8 +14,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Composition.Recognizers public EntityRecognizerSet() { } /// - /// Recognizer pool. + /// Gets or sets recognizer pool. /// + /// + /// Recognizer pool. + /// public IList Recognizers { get; set; } = new List(); /// @@ -68,7 +71,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Composition.Recognizers // switch to next pool of new entities to process entitiesToProcess = newEntitiesToProcess; - } while (entitiesToProcess.Count > 0); + } + while (entitiesToProcess.Count > 0); return allNewEntities; } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Composition/Slots/TimeSpanSlot.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Composition/Slots/TimeSpanSlot.cs index 09e609b96..9108f89b7 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Composition/Slots/TimeSpanSlot.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Composition/Slots/TimeSpanSlot.cs @@ -1,4 +1,5 @@  + //using System; //using System.Threading.Tasks; diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Debugging/DebugTransport.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Debugging/DebugTransport.cs index bb20065bd..4469422cd 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Debugging/DebugTransport.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Debugging/DebugTransport.cs @@ -38,7 +38,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Debugging listener.Start(); using (cancellationToken.Register(listener.Stop)) { - var local = (IPEndPoint) listener.LocalEndpoint; + var local = (IPEndPoint)listener.LocalEndpoint; + // output is parsed on launch by "vscode-dialog-debugger\src\ts\extension.ts" Console.WriteLine($"{nameof(DebugTransport)}\t{local.Address}\t{local.Port}"); diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Parsers/TemplateExpressionParser.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Parsers/TemplateExpressionParser.cs index c0f0c5e7e..29dc271e4 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Parsers/TemplateExpressionParser.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Parsers/TemplateExpressionParser.cs @@ -7,8 +7,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Declarative.Parsers { public static class TemplateExpressionParser { - private static readonly Regex funcRegex = new Regex(@"{\b[^()]+\((.*)\)}$", RegexOptions.Compiled); - private static readonly Regex argsRegex = new Regex(@"([^,]+\(.+?\))|([^,]+)", RegexOptions.Compiled); + private static readonly Regex FuncRegex = new Regex(@"{\b[^()]+\((.*)\)}$", RegexOptions.Compiled); + private static readonly Regex ArgsRegex = new Regex(@"([^,]+\(.+?\))|([^,]+)", RegexOptions.Compiled); // Receives expression of the form: {(, , )} // and returns an object containig the values and a collection of @@ -20,7 +20,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Declarative.Parsers throw new ArgumentException(nameof(template)); } - var func = funcRegex.Match(template); + var func = FuncRegex.Match(template); string innerArgs = func?.Groups?[1]?.Value; @@ -29,7 +29,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Declarative.Parsers throw new ArgumentException(nameof(template), "Expected function format {(, , )}"); } - var paramTags = argsRegex.Matches(innerArgs); + var paramTags = ArgsRegex.Matches(innerArgs); var paramsList = new List(); diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/FolderResourceProvider.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/FolderResourceProvider.cs index f0369e568..e34f32816 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/FolderResourceProvider.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/FolderResourceProvider.cs @@ -105,8 +105,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Declarative.Resources } /// - /// folder to enumerate. + /// Gets or sets folder to enumerate. /// + /// + /// folder to enumerate. + /// public DirectoryInfo Directory { get; set; } public bool IncludeSubFolders { get; set; } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/IResource.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/IResource.cs index b2f9fe367..40d2de6d2 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/IResource.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/IResource.cs @@ -9,8 +9,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Declarative.Resources public interface IResource { /// - /// Resource name. + /// Gets resource name. /// + /// + /// Resource name. + /// string Id { get; } /// diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/IResourceProvider.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/IResourceProvider.cs index 7950e64c0..2c1613ae8 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/IResourceProvider.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/IResourceProvider.cs @@ -7,8 +7,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Declarative.Resources public interface IResourceProvider { /// - /// id for the resource provider. + /// Gets id for the resource provider. /// + /// + /// id for the resource provider. + /// string Id { get; } event ResourceChangedEventHandler Changed; diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/Debugging/Source.cs b/libraries/Microsoft.Bot.Builder.Dialogs/Debugging/Source.cs index 59e7b6769..b2daeb884 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/Debugging/Source.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/Debugging/Source.cs @@ -11,6 +11,13 @@ namespace Microsoft.Bot.Builder.Dialogs.Debugging { public static class Source { + public interface IRegistry + { + void Add(object item, Range range); + + bool TryGetValue(object item, out Range range); + } + public struct Point { public int LineIndex { get; set; } @@ -41,13 +48,6 @@ namespace Microsoft.Bot.Builder.Dialogs.Debugging public override string ToString() => $"{LineIndex}:{CharIndex}"; } - public interface IRegistry - { - void Add(object item, Range range); - - bool TryGetValue(object item, out Range range); - } - public sealed class Range { public string Path { get; set; } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/Dialog.cs b/libraries/Microsoft.Bot.Builder.Dialogs/Dialog.cs index 4c007e56e..080029f3b 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/Dialog.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/Dialog.cs @@ -34,8 +34,11 @@ namespace Microsoft.Bot.Builder.Dialogs } /// - /// Unique id for the dialog. + /// Gets or sets id for the dialog. /// + /// + /// Id for the dialog. + /// public string Id { get @@ -51,18 +54,27 @@ namespace Microsoft.Bot.Builder.Dialogs } /// - /// Set of tags assigned to the dialog. + /// Gets set of tags assigned to the dialog. /// + /// + /// Set of tags assigned to the dialog. + /// public List Tags { get; private set; } = new List(); /// /// Gets or sets expression for the memory slots to bind the dialogs options to on a call to `beginDialog()`. /// + /// + /// Expression for the memory slots to bind the dialogs options to on a call to `beginDialog()`. + /// public Dictionary InputBindings { get; set; } = new Dictionary(); /// /// Gets or sets jSONPath expression for the memory slot to bind the dialogs result to when `endDialog()` is called. /// + /// + /// JSONPath expression for the memory slot to bind the dialogs result to when `endDialog()` is called. + /// public string OutputBinding { get; set; } /// @@ -195,6 +207,7 @@ namespace Microsoft.Bot.Builder.Dialogs /// /// The dialog context for the current turn of conversation. /// The event being raised. + /// Cancellation token. /// Whether the event is handled by the current dialog and further processing should stop. protected virtual Task OnPreBubbleEvent(DialogContext dc, DialogEvent e, CancellationToken cancellationToken) { @@ -210,6 +223,7 @@ namespace Microsoft.Bot.Builder.Dialogs /// /// The dialog context for the current turn of conversation. /// The event being raised. + /// Cancellation token. /// Whether the event is handled by the current dialog and further processing should stop. protected virtual Task OnPostBubbleEvent(DialogContext dc, DialogEvent e, CancellationToken cancellationToken) { diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/DialogContainer.cs b/libraries/Microsoft.Bot.Builder.Dialogs/DialogContainer.cs index d015c3ae1..abf3b24a7 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/DialogContainer.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/DialogContainer.cs @@ -12,7 +12,7 @@ namespace Microsoft.Bot.Builder.Dialogs { public abstract class DialogContainer : Dialog { - protected readonly DialogSet _dialogs = new DialogSet(); + private readonly DialogSet _dialogs = new DialogSet(); public DialogContainer(string dialogId = null) : base(dialogId) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/DialogContext.cs b/libraries/Microsoft.Bot.Builder.Dialogs/DialogContext.cs index eb11b199e..4bd745a6b 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/DialogContext.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/DialogContext.cs @@ -23,9 +23,18 @@ namespace Microsoft.Bot.Builder.Dialogs /// Initializes a new instance of the class. /// /// Parent dialog set. - /// Context for the current turn of conversation with the user. + /// Parent dialog state. /// Current dialog state. - public DialogContext(DialogSet dialogs, DialogContext parentDialogContext, DialogState state, IDictionary conversationState = null, IDictionary userState = null, IDictionary settings = null) + /// Context for the current turn of conversation with the user. + /// Context for the user state. + /// Settings state. + public DialogContext( + DialogSet dialogs, + DialogContext parentDialogContext, + DialogState state, + IDictionary conversationState = null, + IDictionary userState = null, + IDictionary settings = null) { Dialogs = dialogs; Parent = parentDialogContext ?? throw new ArgumentNullException(nameof(parentDialogContext)); @@ -64,36 +73,51 @@ namespace Microsoft.Bot.Builder.Dialogs } /// - /// Parent context. + /// Gets or sets parent context. /// + /// + /// Parent context. + /// public DialogContext Parent { get; set; } /// - /// Set of dialogs which are active for the current dialog container. + /// Gets set of dialogs which are active for the current dialog container. /// + /// + /// Set of dialogs which are active for the current dialog container. + /// public DialogSet Dialogs { get; private set; } /// - /// Turn context. + /// Gets turn context. /// /// /// The context for the current turn of conversation. /// public ITurnContext Context { get; private set; } + /// + /// Gets the current dialog stack. + /// /// /// The current dialog stack. /// public IList Stack { get; private set; } /// - /// Current active scoped state with (user|conversation|dialog|settings scopes). + /// Gets current active scoped state with (user|conversation|dialog|settings scopes). /// + /// + /// Current active scoped state with (user|conversation|dialog|settings scopes). + /// public DialogContextState State { get; private set; } /// - /// Dialog context for child if there is an active child. + /// Gets dialog context for child if there is an active child. /// + /// + /// Dialog context for child if there is an active child. + /// public DialogContext Child { get @@ -143,13 +167,21 @@ namespace Microsoft.Bot.Builder.Dialogs } /// - /// Returns a list of all `Dialog.tags` that are currently on the dialog stack. + /// Gets a list of all `Dialog.tags` that are currently on the dialog stack. /// Any duplicate tags are removed from the returned list and the order of the tag reflects the /// order of the dialogs on the stack. /// The returned list will also include any tags applied as "globalTags". These tags are /// retrieved by calling context.TurnState.get('globalTags')` and will therefore need to be /// assigned for every turn of conversation using context.TurnState.set('globalTags', ['myTag'])`. /// + /// + /// Returns a list of all `Dialog.tags` that are currently on the dialog stack. + /// Any duplicate tags are removed from the returned list and the order of the tag reflects the + /// order of the dialogs on the stack. + /// The returned list will also include any tags applied as "globalTags". These tags are + /// retrieved by calling context.TurnState.get('globalTags')` and will therefore need to be + /// assigned for every turn of conversation using context.TurnState.set('globalTags', ['myTag'])`. + /// public List ActiveTags { get @@ -184,8 +216,11 @@ namespace Microsoft.Bot.Builder.Dialogs } /// - /// The current dialog state for the active dialog. + /// Gets the current dialog state for the active dialog. /// + /// + /// The current dialog state for the active dialog. + /// public Dictionary DialogState { get @@ -409,9 +444,14 @@ namespace Microsoft.Bot.Builder.Dialogs /// /// Deletes any existing dialog stack thus cancelling all dialogs on the stack. /// + /// The event. + /// The event value. /// The cancellation token. /// The dialog context. - public async Task CancelAllDialogsAsync(string eventName = DialogEvents.CancelDialog, object eventValue = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task CancelAllDialogsAsync( + string eventName = DialogEvents.CancelDialog, + object eventValue = null, + CancellationToken cancellationToken = default(CancellationToken)) { if (eventValue is CancellationToken) { diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/DialogContextState.cs b/libraries/Microsoft.Bot.Builder.Dialogs/DialogContextState.cs index 89a141820..9a2e10985 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/DialogContextState.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/DialogContextState.cs @@ -15,16 +15,6 @@ namespace Microsoft.Bot.Builder.Dialogs { public class DialogContextState : IDictionary { - private const string PrefixCallBack = "callstackScope('"; - - private static JsonSerializerSettings expressionCaseSettings = new JsonSerializerSettings - { - ContractResolver = new DefaultContractResolver { NamingStrategy = new CamelCaseNamingStrategy() }, - NullValueHandling = NullValueHandling.Ignore, - }; - - private readonly DialogContext dialogContext; - /// /// Common state properties paths. /// @@ -40,6 +30,16 @@ namespace Microsoft.Bot.Builder.Dialogs public const string STEP_OPTIONS_PROPERTY = "dialog.step.options"; + private const string PrefixCallBack = "callstackScope('"; + + private static JsonSerializerSettings expressionCaseSettings = new JsonSerializerSettings + { + ContractResolver = new DefaultContractResolver { NamingStrategy = new CamelCaseNamingStrategy() }, + NullValueHandling = NullValueHandling.Ignore, + }; + + private readonly DialogContext dialogContext; + public DialogContextState(DialogContext dc, IDictionary settings, IDictionary userState, IDictionary conversationState, IDictionary turnState) { this.dialogContext = dc ?? throw new ArgumentNullException(nameof(dc)); @@ -52,24 +52,36 @@ namespace Microsoft.Bot.Builder.Dialogs /// /// Gets or sets settings for the application. /// + /// + /// Settings for the application. + /// [JsonProperty(PropertyName = "settings")] public IDictionary Settings { get; set; } /// /// Gets or sets state associated with the active user in the turn. /// + /// + /// State associated with the active user in the turn. + /// [JsonProperty(PropertyName = "user")] public IDictionary User { get; set; } /// /// Gets or sets state assocaited with the active conversation for the turn. /// + /// + /// State assocaited with the active conversation for the turn. + /// [JsonProperty(PropertyName = "conversation")] public IDictionary Conversation { get; set; } /// /// Gets or sets state associated with the active dialog for the turn. /// + /// + /// State associated with the active dialog for the turn. + /// [JsonProperty(PropertyName = "dialog")] public IDictionary Dialog { @@ -115,6 +127,9 @@ namespace Microsoft.Bot.Builder.Dialogs /// /// Gets access to the callstack of dialog state. /// + /// + /// Access to the callstack of dialog state. + /// [JsonIgnore] public IEnumerable CallStack { @@ -143,6 +158,9 @@ namespace Microsoft.Bot.Builder.Dialogs /// /// Gets or sets state associated with the current turn only (this is non-persisted). /// + /// + /// State associated with the current turn only (this is non-persisted). + /// [JsonProperty(PropertyName = "turn")] public IDictionary Turn { get; set; } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/DialogEvent.cs b/libraries/Microsoft.Bot.Builder.Dialogs/DialogEvent.cs index 1e25f0016..b95f66d10 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/DialogEvent.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/DialogEvent.cs @@ -8,18 +8,28 @@ namespace Microsoft.Bot.Builder.Dialogs public class DialogEvent { /// - /// If `true` the event will be bubbled to the parent `DialogContext` if not handled by the current dialog. + /// Gets or sets a value indicating whether the event will be bubbled to the parent `DialogContext` + /// if not handled by the current dialog. /// + /// + /// Whether the event can be bubbled to the parent `DialogContext`. + /// public bool Bubble { get; set; } /// - /// Name of the event being raised. + /// Gets or sets name of the event being raised. /// + /// + /// Name of the event being raised. + /// public string Name { get; set; } /// - /// Optional value associated with the event. + /// Gets or sets optional value associated with the event. /// + /// + /// Optional value associated with the event. + /// public object Value { get; set; } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/DialogInstance.cs b/libraries/Microsoft.Bot.Builder.Dialogs/DialogInstance.cs index 60115502c..129da0fca 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/DialogInstance.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/DialogInstance.cs @@ -29,9 +29,13 @@ namespace Microsoft.Bot.Builder.Dialogs public IDictionary State { get; set; } /// + /// Gets or sets a stack index. Positive values are indexes within the current DC and negative values are + /// indexes in the parent DC. + /// + /// /// Positive values are indexes within the current DC and negative values are indexes in /// the parent DC. - /// + /// public int? StackIndex { get; set; } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/DialogManager.cs b/libraries/Microsoft.Bot.Builder.Dialogs/DialogManager.cs index 613bdc57a..4290aaa29 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/DialogManager.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/DialogManager.cs @@ -30,8 +30,11 @@ namespace Microsoft.Bot.Builder.Dialogs } /// - /// Root dialog to use to start conversation. + /// Gets or sets root dialog to use to start conversation. /// + /// + /// Root dialog to use to start conversation. + /// public IDialog RootDialog { get diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/DialogSet.cs b/libraries/Microsoft.Bot.Builder.Dialogs/DialogSet.cs index e12d38ce1..57f4dc688 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/DialogSet.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/DialogSet.cs @@ -125,7 +125,7 @@ namespace Microsoft.Bot.Builder.Dialogs } /// - /// Finds a dialog that was previously added to the set using . + /// Finds a dialog that was previously added to the set using . /// /// ID of the dialog/prompt to look up. /// The dialog if found, otherwise null. diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/DialogTurnResult.cs b/libraries/Microsoft.Bot.Builder.Dialogs/DialogTurnResult.cs index 97d5bb8a8..b23daccdc 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/DialogTurnResult.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/DialogTurnResult.cs @@ -38,8 +38,11 @@ namespace Microsoft.Bot.Builder.Dialogs public object Result { get; set; } /// - /// If true, a DialogCommand has ended its parent container and the parent should not perform any further processing. + /// Gets or sets a value indicating whether a DialogCommand has ended its parent container and the parent should not perform any further processing. /// + /// + /// Whether a DialogCommand has ended its parent container and the parent should not perform any further processing. + /// public bool ParentEnded { get; set; } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/IDialog.cs b/libraries/Microsoft.Bot.Builder.Dialogs/IDialog.cs index 8b1e4f8e1..32ede27d4 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/IDialog.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/IDialog.cs @@ -12,11 +12,17 @@ namespace Microsoft.Bot.Builder.Dialogs /// /// Gets or sets unique id for the dialog. /// + /// + /// Unique id for the dialog. + /// string Id { get; set; } /// /// Gets tags assigned to the dialog. /// + /// + /// Tags assigned to the dialog. + /// List Tags { get; } /// @@ -24,6 +30,9 @@ namespace Microsoft.Bot.Builder.Dialogs /// /// Key = property expression to set in this dialog's memory context, Value = property expression of value you want to get from caller's memory context. /// { "key": "value" } maps to set newDialogState.key = callerDialogState.value. + /// + /// Dictionary of memory bindings which are evaluated in a call to `beginDialog()`. + /// Dictionary InputBindings { get; } /// @@ -31,11 +40,17 @@ namespace Microsoft.Bot.Builder.Dialogs /// /// This the property which the result of EndDialog() for this dialog will be mapped to in the caller's dialog state. /// $foo will be set to EndDialog(result). + /// + /// Expression in the callers memory to store the result returned via `endDialog()` is called. + /// string OutputBinding { get; } /// - /// Telemetry client. + /// Gets or sets telemetry client. /// + /// + /// Telemetry client. + /// IBotTelemetryClient TelemetryClient { get; set; } /// diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/Prompts/OAuthPrompt.cs b/libraries/Microsoft.Bot.Builder.Dialogs/Prompts/OAuthPrompt.cs index 7996b8837..aabebf065 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/Prompts/OAuthPrompt.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/Prompts/OAuthPrompt.cs @@ -45,7 +45,7 @@ namespace Microsoft.Bot.Builder.Dialogs /// ## Prompt Usage /// /// When used with your bot's you can simply add a new instance of the prompt as a named - /// dialog using . You can then start the prompt from a waterfall step using either + /// dialog using . You can then start the prompt from a waterfall step using either /// or /// . The user /// will be prompted to signin as needed and their access token will be passed as an argument to diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/Prompts/Prompt.cs b/libraries/Microsoft.Bot.Builder.Dialogs/Prompts/Prompt.cs index 53d2ddaa4..9da5ab057 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/Prompts/Prompt.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/Prompts/Prompt.cs @@ -19,7 +19,7 @@ namespace Microsoft.Bot.Builder.Dialogs /// The type of value the prompt returns. /// When the prompt ends, it should return a object that /// represents the value that was prompted for. - /// Use or + /// Use or /// to add a prompt to a dialog set or component dialog, respectively. /// Use or /// to start the prompt. diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/Templating/ActivityTemplate.cs b/libraries/Microsoft.Bot.Builder.Dialogs/Templating/ActivityTemplate.cs index ba53682d6..c938930cc 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/Templating/ActivityTemplate.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/Templating/ActivityTemplate.cs @@ -21,6 +21,9 @@ namespace Microsoft.Bot.Builder.Dialogs /// /// Gets or sets the template to evaluate to create the IMessageActivity. /// + /// + /// The template to evaluate to create the IMessageActivity. + /// public string Template { get; set; } public async Task BindToData(ITurnContext context, object data) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/WaterfallStepContext.cs b/libraries/Microsoft.Bot.Builder.Dialogs/WaterfallStepContext.cs index 7ad5db2e8..6514d044d 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/WaterfallStepContext.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/WaterfallStepContext.cs @@ -17,15 +17,28 @@ namespace Microsoft.Bot.Builder.Dialogs /// Initializes a new instance of the class. /// Provides context for a turn of a waterfall dialog. Contains ITurnContext as property 'Context'. /// - /// The parent of the waterfall dialog. + /// The parent of the waterfall dialog. /// The dialog's context. /// Any options to call the waterfall dialog with. /// A dictionary of values which will be persisted across all waterfall steps. /// The index of the current waterfall to execute. /// The reason the waterfall step is being executed. /// Results returned by a dialog called in the previous waterfall step. - internal WaterfallStepContext(WaterfallDialog parentWaterfall, DialogContext dc, object options, IDictionary values, int index, DialogReason reason, object result = null) - : base(dc.Dialogs, turnContext: dc.Context, state: new DialogState(dc.Stack), conversationState: dc.State.Conversation, userState: dc.State.User, settings: dc.State.Settings) + internal WaterfallStepContext( + WaterfallDialog parentWaterfall, + DialogContext dc, + object options, + IDictionary values, + int index, + DialogReason reason, + object result = null) + : base( + dc.Dialogs, + turnContext: dc.Context, + state: new DialogState(dc.Stack), + conversationState: dc.State.Conversation, + userState: dc.State.User, + settings: dc.State.Settings) { _parentWaterfall = parentWaterfall; _nextCalled = false; diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/templating/TextMessageActivityGenerator.cs b/libraries/Microsoft.Bot.Builder.Dialogs/templating/TextMessageActivityGenerator.cs index 7ea043d2c..cda2b26d0 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/templating/TextMessageActivityGenerator.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/templating/TextMessageActivityGenerator.cs @@ -17,6 +17,161 @@ namespace Microsoft.Bot.Builder.Dialogs /// public class TextMessageActivityGenerator : IMessageActivityGenerator { + private static int AddJsonAttachment(IMessageActivity activity, string[] lines, int iLine) + { + StringBuilder sb = new StringBuilder(); + for (; iLine < lines.Length; iLine++) + { + if (lines[iLine].TrimEnd() == "]") + { + break; + } + + sb.AppendLine(lines[iLine]); + } + + dynamic obj = JsonConvert.DeserializeObject(sb.ToString()); + string contentType = "application/json"; + + if (obj.type == "AdaptiveCard") + { + contentType = "application/vnd.microsoft.card.adaptive"; + } + + var attachment = new Attachment(contentType, content: obj); + activity.Attachments.Add(attachment); + return iLine; + } + + private static void AddSuggestions(IMessageActivity activity, string line) + { + var value = line.Split('='); + if (value.Length > 1) + { + var suggestions = value[1].Split('|'); + activity.SuggestedActions = new SuggestedActions(); + activity.SuggestedActions.Actions = suggestions.Select(s => + { + var text = s.TrimEnd(']').Trim(); + return new CardAction(type: ActionTypes.MessageBack, title: text, displayText: text, text: text); + }).ToList(); + } + } + + private static void AddAttachmentLayout(IMessageActivity activity, string line) + { + var value = line.Split('='); + if (value.Length > 1) + { + activity.AttachmentLayout = value[1].TrimEnd(']').Trim(); + } + } + + private static int AddGenericCardAtttachment(IMessageActivity activity, string type, string[] lines, int iLine) + { + var attachment = new Attachment(type, content: new JObject()); + iLine = BuildGenericCard(attachment.Content, type, lines, iLine); + activity.Attachments.Add(attachment); + return iLine; + } + + private static int BuildGenericCard(dynamic card, string type, string[] lines, int iLine) + { + bool lastLine = false; + + for (; !lastLine && iLine < lines.Length; iLine++) + { + var line = lines[iLine]; + var start = line.IndexOf('='); + if (start > 0) + { + var property = line.Substring(0, start).Trim().ToLower(); + var value = line.Substring(start + 1).Trim(); + if (value.EndsWith("]")) + { + value = value.TrimEnd(']'); + lastLine = true; + } + + switch (property.ToLower()) + { + case "title": + case "subtitle": + case "text": + case "aspect": + case "value": + case "connectionName": + card[property] = value; + break; + + case "image": + case "images": + if (type == HeroCard.ContentType || type == ThumbnailCard.ContentType) + { + // then it's images + if (card["images"] == null) + { + card["images"] = new JArray(); + } + + var urlObj = new JObject() { { "url", value } }; + ((JArray)card["images"]).Add(urlObj); + } + else + { + // then it's image + var urlObj = new JObject() { { "url", value } }; + card["image"] = urlObj; + } + + break; + + case "media": + if (card[property] == null) + { + card[property] = new JArray(); + } + + var mediaObj = new JObject() { { "url", value } }; + ((JArray)card[property]).Add(mediaObj); + break; + + case "buttons": + if (card[property] == null) + { + card[property] = new JArray(); + } + + foreach (var button in value.Split('|')) + { + var buttonObj = new JObject() { { "title", button.Trim() }, { "type", "imBack" }, { "value", button.Trim() } }; + ((JArray)card[property]).Add(buttonObj); + } + + break; + + case "autostart": + case "sharable": + case "autoloop": + card[property] = value.ToLower() == "true"; + break; + case "": + break; + default: + System.Diagnostics.Debug.WriteLine(string.Format("Skipping unknown card property {0}", property)); + break; + } + + if (lastLine) + { + break; + } + } + } + + return iLine; + } + // Fixed text constructor public TextMessageActivityGenerator() { @@ -57,8 +212,8 @@ namespace Microsoft.Bot.Builder.Dialogs /// /// text. /// data to bind to. - /// languageGenerator. /// turnContext. + /// languageGenerator. /// MessageActivity for it. public async Task CreateActivityFromText(string text, object data, ITurnContext turnContext, ILanguageGenerator languageGenerator) { @@ -270,160 +425,5 @@ namespace Microsoft.Bot.Builder.Dialogs activity.Attachments.Add(attachment); } - - private static int AddJsonAttachment(IMessageActivity activity, string[] lines, int iLine) - { - StringBuilder sb = new StringBuilder(); - for (; iLine < lines.Length; iLine++) - { - if (lines[iLine].TrimEnd() == "]") - { - break; - } - - sb.AppendLine(lines[iLine]); - } - - dynamic obj = JsonConvert.DeserializeObject(sb.ToString()); - string contentType = "application/json"; - - if (obj.type == "AdaptiveCard") - { - contentType = "application/vnd.microsoft.card.adaptive"; - } - - var attachment = new Attachment(contentType, content: obj); - activity.Attachments.Add(attachment); - return iLine; - } - - private static void AddSuggestions(IMessageActivity activity, string line) - { - var value = line.Split('='); - if (value.Length > 1) - { - var suggestions = value[1].Split('|'); - activity.SuggestedActions = new SuggestedActions(); - activity.SuggestedActions.Actions = suggestions.Select(s => - { - var text = s.TrimEnd(']').Trim(); - return new CardAction(type: ActionTypes.MessageBack, title: text, displayText: text, text: text); - }).ToList(); - } - } - - private static void AddAttachmentLayout(IMessageActivity activity, string line) - { - var value = line.Split('='); - if (value.Length > 1) - { - activity.AttachmentLayout = value[1].TrimEnd(']').Trim(); - } - } - - private static int AddGenericCardAtttachment(IMessageActivity activity, string type, string[] lines, int iLine) - { - var attachment = new Attachment(type, content: new JObject()); - iLine = BuildGenericCard(attachment.Content, type, lines, iLine); - activity.Attachments.Add(attachment); - return iLine; - } - - private static int BuildGenericCard(dynamic card, string type, string[] lines, int iLine) - { - bool lastLine = false; - - for (; !lastLine && iLine < lines.Length; iLine++) - { - var line = lines[iLine]; - var start = line.IndexOf('='); - if (start > 0) - { - var property = line.Substring(0, start).Trim().ToLower(); - var value = line.Substring(start + 1).Trim(); - if (value.EndsWith("]")) - { - value = value.TrimEnd(']'); - lastLine = true; - } - - switch (property.ToLower()) - { - case "title": - case "subtitle": - case "text": - case "aspect": - case "value": - case "connectionName": - card[property] = value; - break; - - case "image": - case "images": - if (type == HeroCard.ContentType || type == ThumbnailCard.ContentType) - { - // then it's images - if (card["images"] == null) - { - card["images"] = new JArray(); - } - - var urlObj = new JObject() { { "url", value } }; - ((JArray)card["images"]).Add(urlObj); - } - else - { - // then it's image - var urlObj = new JObject() { { "url", value } }; - card["image"] = urlObj; - } - - break; - - case "media": - if (card[property] == null) - { - card[property] = new JArray(); - } - - var mediaObj = new JObject() { { "url", value } }; - ((JArray)card[property]).Add(mediaObj); - break; - - case "buttons": - if (card[property] == null) - { - card[property] = new JArray(); - } - - foreach (var button in value.Split('|')) - { - var buttonObj = new JObject() { { "title", button.Trim() }, { "type", "imBack" }, { "value", button.Trim() } }; - ((JArray)card[property]).Add(buttonObj); - } - - break; - - case "autostart": - case "sharable": - case "autoloop": - card[property] = value.ToLower() == "true"; - break; - case "": - break; - default: - System.Diagnostics.Debug.WriteLine(string.Format("Skipping unknown card property {0}", property)); - break; - } - - if (lastLine) - { - break; - } - } - } - - return iLine; - } } } diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/templating/TextTemplate.cs b/libraries/Microsoft.Bot.Builder.Dialogs/templating/TextTemplate.cs index e47b7641b..32b6e4dab 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs/templating/TextTemplate.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs/templating/TextTemplate.cs @@ -19,6 +19,9 @@ namespace Microsoft.Bot.Builder.Dialogs /// /// Gets or sets the template to evaluate to create the IMessageActivity. /// + /// + /// The template to evaluate to create the IMessageActivity. + /// public string Template { get; set; } public async Task BindToData(ITurnContext turnContext, object data) diff --git a/libraries/Microsoft.Bot.Builder.Expressions/BuiltInFunctions.cs b/libraries/Microsoft.Bot.Builder.Expressions/BuiltInFunctions.cs index eeb41cdec..1cd330aab 100644 --- a/libraries/Microsoft.Bot.Builder.Expressions/BuiltInFunctions.cs +++ b/libraries/Microsoft.Bot.Builder.Expressions/BuiltInFunctions.cs @@ -53,6 +53,11 @@ namespace Microsoft.Bot.Builder.Expressions /// Null if value if correct or error string otherwise. public delegate string VerifyExpression(object value, Expression expression, int child); + /// + /// Dictionary of built-in functions. + /// + private static readonly Dictionary _functions = BuildFunctionLookup(); + // Validators do static validation of expressions /// @@ -229,6 +234,7 @@ namespace Microsoft.Bot.Builder.Expressions /// /// Value to check. /// Expression that led to value. + /// No function. /// Error or null if valid. public static string VerifyNumber(object value, Expression expression, int number) { @@ -245,6 +251,7 @@ namespace Microsoft.Bot.Builder.Expressions /// /// Value to check. /// Expression that led to value. + /// No function. /// Error or null if valid. public static string VerifyNumericList(object value, Expression expression, int number) { @@ -272,6 +279,7 @@ namespace Microsoft.Bot.Builder.Expressions /// /// Value to check. /// Expression that led to value. + /// No function. /// Error or null if valid. public static string VerifyContainer(object value, Expression expression, int number) { @@ -288,6 +296,7 @@ namespace Microsoft.Bot.Builder.Expressions /// /// Value to check. /// Expression that led to value. + /// No function. /// Error or null if valid. public static string VerifyList(object value, Expression expression, int number) { @@ -322,6 +331,7 @@ namespace Microsoft.Bot.Builder.Expressions /// /// Value to check. /// Expression that led to value. + /// No function. /// Error or null if valid. public static string VerifyInteger(object value, Expression expression, int number) { @@ -338,6 +348,7 @@ namespace Microsoft.Bot.Builder.Expressions /// /// Value to check. /// Expression that led to value. + /// No function. /// Error or null if valid. public static string VerifyString(object value, Expression expression, int number) { @@ -354,6 +365,7 @@ namespace Microsoft.Bot.Builder.Expressions /// /// Value to check. /// Expression that led to value. + /// No function. /// Error or null if valid. public static string VerifyNotNull(object value, Expression expression, int number) { @@ -370,6 +382,7 @@ namespace Microsoft.Bot.Builder.Expressions /// /// Value to check. /// Expression that led to value. + /// No function. /// Error or null if valid. public static string VerifyNumberOrString(object value, Expression expression, int number) { @@ -386,6 +399,7 @@ namespace Microsoft.Bot.Builder.Expressions /// /// Value to check. /// Expression that led to value. + /// No function. /// Error or null if valid. public static string VerifyBoolean(object value, Expression expression, int number) { @@ -495,40 +509,6 @@ namespace Microsoft.Bot.Builder.Expressions return (value, error); }; - /// - /// walk dialog callstack looking for property. - /// - /// - /// - /// - private static (object value, string error) CallstackScope(Expression expression, object state) - { - // get collection - var (result, error) = AccessProperty(state, "callstack"); - if (result != null) - { - var items = (IEnumerable)result; - object property = null; - (property, error) = expression.Children[0].TryEvaluate(state); - if (property != null && error == null) - { - foreach (var item in items) - { - // get property off of item - (result, error) = AccessProperty(item, property.ToString()); - - // if not null - if (error == null && result != null) - { - // return it - return (result, null); - } - } - } - } - return (null, error); - } - /// /// Generate an expression delegate that applies function on the accumulated value after verifying all children. /// @@ -691,6 +671,40 @@ namespace Microsoft.Bot.Builder.Expressions return eval; } + /// + /// walk dialog callstack looking for property. + /// + /// + /// + /// + private static (object value, string error) CallstackScope(Expression expression, object state) + { + // get collection + var (result, error) = AccessProperty(state, "callstack"); + if (result != null) + { + var items = (IEnumerable)result; + object property = null; + (property, error) = expression.Children[0].TryEvaluate(state); + if (property != null && error == null) + { + foreach (var item in items) + { + // get property off of item + (result, error) = AccessProperty(item, property.ToString()); + + // if not null + if (error == null && result != null) + { + // return it + return (result, null); + } + } + } + } + return (null, error); + } + private static void ValidateAccessor(Expression expression) { var children = expression.Children; @@ -1084,7 +1098,7 @@ namespace Microsoft.Bot.Builder.Expressions /// /// return new object list replace jarray.ToArray<object>(). /// - /// + /// /// private static IList ResolveListValue(object instance) { @@ -2009,7 +2023,7 @@ namespace Microsoft.Bot.Builder.Expressions { if (products.Count() == 1) { - result = ResolveValue(products.ElementAt(0)); ; + result = ResolveValue(products.ElementAt(0)); } else if (products.Count() > 1) { @@ -3305,10 +3319,5 @@ namespace Microsoft.Bot.Builder.Expressions lookup.Add("concat", lookup[ExpressionType.Concat]); return lookup; } - - /// - /// Dictionary of built-in functions. - /// - private static readonly Dictionary _functions = BuildFunctionLookup(); } } diff --git a/libraries/Microsoft.Bot.Builder.Expressions/CommonRegex.cs b/libraries/Microsoft.Bot.Builder.Expressions/CommonRegex.cs index c55b1dd58..a5f50705a 100644 --- a/libraries/Microsoft.Bot.Builder.Expressions/CommonRegex.cs +++ b/libraries/Microsoft.Bot.Builder.Expressions/CommonRegex.cs @@ -10,12 +10,12 @@ namespace Microsoft.Bot.Builder.Expressions { public class CommonRegex { - private static readonly LRUCache regexCache = new LRUCache(15); + private static readonly LRUCache RegexCache = new LRUCache(15); public static Regex CreateRegex(string pattern) { Regex result; - if (!string.IsNullOrEmpty(pattern) && regexCache.TryGet(pattern, out var regex)) + if (!string.IsNullOrEmpty(pattern) && RegexCache.TryGet(pattern, out var regex)) { result = regex; } @@ -27,7 +27,7 @@ namespace Microsoft.Bot.Builder.Expressions } result = new Regex(pattern, RegexOptions.Compiled); - regexCache.Set(pattern, result); + RegexCache.Set(pattern, result); } return result; diff --git a/libraries/Microsoft.Bot.Builder.Expressions/Expression.cs b/libraries/Microsoft.Bot.Builder.Expressions/Expression.cs index e899e5f2d..87136d1f3 100644 --- a/libraries/Microsoft.Bot.Builder.Expressions/Expression.cs +++ b/libraries/Microsoft.Bot.Builder.Expressions/Expression.cs @@ -259,7 +259,7 @@ namespace Microsoft.Bot.Builder.Expressions /// Evaluate the expression. /// /// - /// Global state to evaluate accessor expressions against. Can be , + /// Global state to evaluate accessor expressions against. Can be , /// otherwise reflection is used to access property and then indexer. /// /// Computed value and an error string. If the string is non-null, then there was an evaluation error. diff --git a/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/LanguageGeneratorManager.cs b/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/LanguageGeneratorManager.cs index 72e0e02f8..2c1b402d1 100644 --- a/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/LanguageGeneratorManager.cs +++ b/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/LanguageGeneratorManager.cs @@ -54,8 +54,11 @@ namespace Microsoft.Bot.Builder.LanguageGeneration } /// - /// Generators. + /// Gets or sets generators. /// + /// + /// Generators. + /// public ConcurrentDictionary LanguageGenerators { get; set; } = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); public static ImportResolverDelegate ResourceResolver(ResourceExplorer resourceExplorer) => diff --git a/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/MultiLanguageGeneratorBase.cs b/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/MultiLanguageGeneratorBase.cs index 6d74e3d61..7229ec5b1 100644 --- a/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/MultiLanguageGeneratorBase.cs +++ b/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/MultiLanguageGeneratorBase.cs @@ -28,8 +28,11 @@ namespace Microsoft.Bot.Builder.LanguageGeneration public abstract bool TryGetGenerator(ITurnContext context, string locale, out ILanguageGenerator generator); /// - /// Language Policy which defines per language fallback policies. + /// Gets or sets language Policy which defines per language fallback policies. /// + /// + /// Language Policy which defines per language fallback policies. + /// public ILanguagePolicy LanguagePolicy { get; set; } = new LanguagePolicy(); public async Task Generate(ITurnContext turnContext, string template, object data) diff --git a/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/ResourceMultiLanguageGenerator.cs b/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/ResourceMultiLanguageGenerator.cs index 749bcd95b..b3b0acb17 100644 --- a/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/ResourceMultiLanguageGenerator.cs +++ b/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/ResourceMultiLanguageGenerator.cs @@ -16,7 +16,7 @@ namespace Microsoft.Bot.Builder.LanguageGeneration /// Initializes a new instance of the class. /// /// foo.lg. - public ResourceMultiLanguageGenerator(string resourceId=null) + public ResourceMultiLanguageGenerator(string resourceId = null) { this.ResourceId = resourceId; } diff --git a/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/TemplateEngineLanguageGenerator.cs b/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/TemplateEngineLanguageGenerator.cs index 74887706b..47d52f2e1 100644 --- a/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/TemplateEngineLanguageGenerator.cs +++ b/libraries/Microsoft.Bot.Builder.LanguageGeneration.Renderer/TemplateEngineLanguageGenerator.cs @@ -45,6 +45,9 @@ namespace Microsoft.Bot.Builder.LanguageGeneration /// /// Gets or sets id of the source of this template (used for labeling errors). /// + /// + /// Id of the source of this template (used for labeling errors). + /// public string Id { get; set; } = String.Empty; /// diff --git a/libraries/Microsoft.Bot.Builder.TemplateManager/TemplateManager.cs b/libraries/Microsoft.Bot.Builder.TemplateManager/TemplateManager.cs index bae8fdfea..b9858a5db 100644 --- a/libraries/Microsoft.Bot.Builder.TemplateManager/TemplateManager.cs +++ b/libraries/Microsoft.Bot.Builder.TemplateManager/TemplateManager.cs @@ -20,13 +20,19 @@ namespace Microsoft.Bot.Builder.TemplateManager } /// - /// Template Renderers. + /// Gets or sets template Renderers. /// + /// + /// Template Renderers. + /// public List Renderers { get; set; } = new List(); /// - /// Language fallback policy. + /// Gets or sets language fallback policy. /// + /// + /// Language fallback policy. + /// public List LanguageFallback { get; set; } = new List(); /// diff --git a/libraries/Microsoft.Bot.Builder.TemplateManager/TemplateManagerMiddleware.cs b/libraries/Microsoft.Bot.Builder.TemplateManager/TemplateManagerMiddleware.cs index 461743bea..f3a68af39 100644 --- a/libraries/Microsoft.Bot.Builder.TemplateManager/TemplateManagerMiddleware.cs +++ b/libraries/Microsoft.Bot.Builder.TemplateManager/TemplateManagerMiddleware.cs @@ -29,13 +29,19 @@ namespace Microsoft.Bot.Builder.TemplateManager } /// - /// Template Renderers. + /// Gets or sets template Renderers. /// + /// + /// Template Renderers. + /// public List Renderers { get { return this.TemplateManager.Renderers; } set { this.TemplateManager.Renderers = value; } } /// - /// Language fallback policy. + /// Gets or sets language fallback policy. /// + /// + /// Language fallback policy. + /// public List LanguageFallback { get { return this.TemplateManager.LanguageFallback; } set { this.TemplateManager.LanguageFallback = value; } } /// diff --git a/libraries/Microsoft.Bot.Builder/FileTranscriptLogger.cs b/libraries/Microsoft.Bot.Builder/FileTranscriptLogger.cs index 991ab26ee..7c337d74c 100644 --- a/libraries/Microsoft.Bot.Builder/FileTranscriptLogger.cs +++ b/libraries/Microsoft.Bot.Builder/FileTranscriptLogger.cs @@ -20,16 +20,16 @@ namespace Microsoft.Bot.Builder /// public class FileTranscriptLogger : ITranscriptStore { - private string folder; - private bool unitTestMode; - private HashSet started = new HashSet(); - private static JsonSerializerSettings jsonSettings = new JsonSerializerSettings() { Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore, }; + private string folder; + private bool unitTestMode; + private HashSet started = new HashSet(); + /// /// Initializes a new instance of the class. /// diff --git a/tests/Microsoft.Bot.Builder.AI.TriggerTrees.Tests/Generator.cs b/tests/Microsoft.Bot.Builder.AI.TriggerTrees.Tests/Generator.cs index c38e1f2bc..c8641482b 100644 --- a/tests/Microsoft.Bot.Builder.AI.TriggerTrees.Tests/Generator.cs +++ b/tests/Microsoft.Bot.Builder.AI.TriggerTrees.Tests/Generator.cs @@ -105,7 +105,7 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees.Tests Rand = new Random(seed); } - private static readonly string[] comparisons = new string[] + private static readonly string[] Comparisons = new string[] { ExpressionType.LessThan, ExpressionType.LessThanOrEqual, @@ -164,7 +164,7 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees.Tests { Expression expression = null; object value = null; - var type = RandomChoice(comparisons); + var type = RandomChoice(Comparisons); switch (Rand.Next(2)) { case 0: @@ -246,7 +246,8 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees.Tests do { choice = Rand.Next(predicates.Count); - } while (used.Contains(choice)); + } + while (used.Contains(choice)); expressions.Add(predicates[choice]); used.Add(choice); @@ -273,7 +274,8 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees.Tests do { choice = Rand.Next(predicates.Count); - } while (used.Contains(choice)); + } + while (used.Contains(choice)); expressions.Add(predicates[choice]); used.Add(choice); } @@ -299,7 +301,8 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees.Tests do { choice = Rand.Next(predicates.Count); - } while (used.Contains(choice)); + } + while (used.Contains(choice)); var predicate = predicates[choice]; if (j == 0) @@ -386,11 +389,13 @@ namespace Microsoft.Bot.Builder.AI.TriggerTrees.Tests for (var quant = 0; quant < maxBase; ++quant) { KeyValuePair baseBinding; + // Can only map each expression variable once in a quantifier do { baseBinding = expression.Bindings.ElementAt(Rand.Next(expression.Bindings.Count)); - } while (chosen.Contains(baseBinding.Key)); + } + while (chosen.Contains(baseBinding.Key)); chosen.Add(baseBinding.Key); SplitMemory(baseBinding.Key, out var baseName); var mappings = new List(); diff --git a/tests/Microsoft.Bot.Builder.Azure.Tests/AzureBlobTranscriptStoreTests.cs b/tests/Microsoft.Bot.Builder.Azure.Tests/AzureBlobTranscriptStoreTests.cs index 9e961d01f..8f925203b 100644 --- a/tests/Microsoft.Bot.Builder.Azure.Tests/AzureBlobTranscriptStoreTests.cs +++ b/tests/Microsoft.Bot.Builder.Azure.Tests/AzureBlobTranscriptStoreTests.cs @@ -425,12 +425,14 @@ namespace Microsoft.Bot.Builder.Azure.Tests Assert.AreEqual("foo", pagedResult.Items[0].AsMessageActivity().Text); Assert.AreEqual("new response", pagedResult.Items[1].AsMessageActivity().Text); Assert.AreEqual("update", pagedResult.Items[2].AsMessageActivity().Text); + // Perform some queries pagedResult = await TranscriptStore.GetTranscriptActivitiesAsync(conversation.ChannelId, conversation.Conversation.Id, null, DateTimeOffset.MinValue); Assert.AreEqual(3, pagedResult.Items.Length); Assert.AreEqual("foo", pagedResult.Items[0].AsMessageActivity().Text); Assert.AreEqual("new response", pagedResult.Items[1].AsMessageActivity().Text); Assert.AreEqual("update", pagedResult.Items[2].AsMessageActivity().Text); + // Perform some queries pagedResult = await TranscriptStore.GetTranscriptActivitiesAsync(conversation.ChannelId, conversation.Conversation.Id, null, DateTimeOffset.MaxValue); Assert.AreEqual(0, pagedResult.Items.Length); diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/ActionTests.cs b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/ActionTests.cs index 477c27a79..c1b8a0a76 100644 --- a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/ActionTests.cs +++ b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/ActionTests.cs @@ -57,7 +57,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests { new TextInput() { Prompt = new ActivityTemplate("Hello, what is your name?"), OutputBinding = "user.name" }, new SendActivity("Hello {user.name}, nice to meet you!"), - })}); + }) + }); await CreateFlow(testDialog) .Send("hi") @@ -129,7 +130,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Name = "test", ValueType = "memory" } - })}); + }) + }); await CreateFlow(dialog, sendTrace: true) .Send("hi") @@ -164,7 +166,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Condition = "!dialog.foo && user.name == null", Actions = new List() { - new TextInput() { + new TextInput() + { Prompt = new ActivityTemplate("Hello, what is your name?"), OutputBinding = "user.name" }, @@ -175,7 +178,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("Hello {user.name}, nice to see you again!") } }, - })}); + }) + }); await CreateFlow(testDialog) .Send("hi") @@ -366,7 +370,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests } }, new SendActivity("Hello {user.name}, nice to meet you!") - })}); + }) + }); await CreateFlow(testDialog) .Send("hi") @@ -389,7 +394,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests { Actions = new List() { - new NumberInput() { + new NumberInput() + { MaxTurnCount = 1, DefaultValue = "10", Prompt = new ActivityTemplate("What is your age?"), @@ -817,7 +823,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests } }, new SendActivity("Hello {user.name}, nice to meet you!") - })}); + }) + }); await CreateFlow(testDialog) .Send("hi") @@ -836,7 +843,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests { Recognizer = new RegexRecognizer() { - Intents = new Dictionary() { + Intents = new Dictionary() + { { "Replace", "(?i)replace" } } } @@ -848,7 +856,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests { Actions = new List() { - new TextInput() { + new TextInput() + { Prompt = new ActivityTemplate("Say replace to replace these actions"), Property = "turn.tempInput" }, @@ -856,15 +865,20 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new RepeatDialog() } }, - new OnIntent() { + new OnIntent() + { Intent = "Replace", - Actions = new List() { + Actions = new List() + { new SendActivity("I'm going to replace the original actions via EditActions"), - new EditActions() { + new EditActions() + { ChangeType = ActionChangeType.ReplaceSequence, - Actions = new List() { + Actions = new List() + { new SendActivity("New actions..."), - new TextInput() { + new TextInput() + { Prompt = new ActivityTemplate("What's your name?"), Property = "turn.tempInput" } @@ -891,7 +905,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests { Recognizer = new RegexRecognizer() { - Intents = new Dictionary() { + Intents = new Dictionary() + { { "Insert", "(?i)insert" }, { "Execute", "(?i)execute" } } @@ -968,7 +983,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests } }, new SendActivity("Hello {user.name}, nice to meet you!") - })}); + }) + }); await CreateFlow(testDialog) .Send("hi") diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/AdaptiveDialogTests.cs b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/AdaptiveDialogTests.cs index f1c5dc1b5..d7b1f418a 100644 --- a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/AdaptiveDialogTests.cs +++ b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/AdaptiveDialogTests.cs @@ -120,7 +120,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Actions = new List() { // Add item - new TextInput() { + new TextInput() + { AlwaysPrompt = true, Prompt = new ActivityTemplate("Please add an item to todos."), Property = "dialog.todo" @@ -138,7 +139,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity() { Activity = new ActivityTemplate("Your todos: {join(user.todos, ',')}") }, // Remove item - new TextInput() { + new TextInput() + { AlwaysPrompt = true, Prompt = new ActivityTemplate("Enter a item to remove."), Property = "dialog.todo" @@ -147,7 +149,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity() { Activity = new ActivityTemplate("Your todos: {join(user.todos, ',')}") }, // Add item and pop item - new TextInput() { + new TextInput() + { AlwaysPrompt = true, Prompt = new ActivityTemplate("Please add an item to todos."), Property = "dialog.todo" @@ -209,7 +212,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Condition = "user.name == null", Actions = new List() { - new TextInput() { + new TextInput() + { Prompt = new ActivityTemplate("Hello, what is your name?"), Property = "user.name" }, @@ -350,7 +354,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests }, new OnIntent() { - Intent="JokeIntent", + Intent = "JokeIntent", Actions = new List() { new SendActivity("Why did the chicken cross the road?"), @@ -360,7 +364,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests }, new OnIntent() { - Intent="HelloIntent", + Intent = "HelloIntent", Actions = new List() { new SendActivity("Hello {user.name}, nice to meet you!") @@ -420,7 +424,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests }, new OnIntent() { - Intent= "GreetingIntent", + Intent = "GreetingIntent", Actions = new List() { new SendActivity("Hello {user.name}, nice to meet you!") @@ -586,7 +590,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests } }; - innerDialog.AddDialogs(new[] { + innerDialog.AddDialogs(new[] + { new AdaptiveDialog("Greeting") { Events = new List() @@ -1096,7 +1101,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Generator = new TemplateEngineLanguageGenerator(), Recognizer = new RegexRecognizer() { - Intents = new Dictionary() { + Intents = new Dictionary() + { { "Interruption", "(?i)interrupt" }, { "Greeting", "(?i)hi" }, { "Start", "(?i)start" }, @@ -1117,7 +1123,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new OnIntent() { Intent = "reset", - Actions = new List() { + Actions = new List() + { new DeleteProperty() { Property = "user.name" @@ -1125,10 +1132,13 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("Sure. I've reset your profile.") } }, - new OnIntent() { + new OnIntent() + { Intent = "Start", - Actions = new List() { - new TextInput() { + Actions = new List() + { + new TextInput() + { Prompt = new ActivityTemplate("What is your name?"), Property = "user.name", AllowInterruptions = AllowInterruptions.Always @@ -1136,11 +1146,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("I have {user.name} as your name") } }, - new OnIntent() { + new OnIntent() + { Intent = "Interruption", - Actions = new List() { + Actions = new List() + { // short circuiting Interruption so consultation is terminated. new SendActivity("In Interruption..."), + // request the active input step to re-process user input. new SetProperty() { @@ -1149,9 +1162,11 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests } } }, - new OnIntent() { + new OnIntent() + { Intent = "Greeting", - Actions = new List() { + Actions = new List() + { new SendActivity("Hi, I'm the test bot!") } }, @@ -1205,17 +1220,21 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Generator = new TemplateEngineLanguageGenerator(), Recognizer = new RegexRecognizer() { - Intents = new Dictionary() { + Intents = new Dictionary() + { { "Interruption", "(?i)interrupt" }, { "Start", "(?i)start" } } }, Events = new List() { - new OnIntent() { + new OnIntent() + { Intent = "Start", - Actions = new List() { - new TextInput() { + Actions = new List() + { + new TextInput() + { Prompt = new ActivityTemplate("What is your name?"), Property = "user.name", AllowInterruptions = AllowInterruptions.Always @@ -1223,11 +1242,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("I have {user.name} as your name") } }, - new OnIntent() { + new OnIntent() + { Intent = "Interruption", - Actions = new List() { + Actions = new List() + { // short circuiting Interruption so consultation is terminated. new SendActivity("In Interruption..."), + // request the active input step to re-process user input. new SetProperty() { @@ -1256,17 +1278,21 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Generator = new TemplateEngineLanguageGenerator(), Recognizer = new RegexRecognizer() { - Intents = new Dictionary() { + Intents = new Dictionary() + { { "Interruption", "(?i)interrupt" }, { "Start", "(?i)start" } } }, Events = new List() { - new OnIntent() { + new OnIntent() + { Intent = "Start", - Actions = new List() { - new TextInput() { + Actions = new List() + { + new TextInput() + { Prompt = new ActivityTemplate("What is your name?"), Property = "user.name", AllowInterruptions = AllowInterruptions.Always @@ -1281,11 +1307,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("I have {user.age} as your age") } }, - new OnIntent() { + new OnIntent() + { Intent = "Interruption", - Actions = new List() { + Actions = new List() + { // short circuiting Interruption so consultation is terminated. new SendActivity("In Interruption..."), + // request the active input step to re-process user input. new SetProperty() { @@ -1331,17 +1360,21 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Generator = new TemplateEngineLanguageGenerator(), Recognizer = new RegexRecognizer() { - Intents = new Dictionary() { + Intents = new Dictionary() + { { "Start", "(?i)start" }, { "None", "200" } } }, Events = new List() { - new OnIntent() { + new OnIntent() + { Intent = "Start", - Actions = new List() { - new NumberInput() { + Actions = new List() + { + new NumberInput() + { Prompt = new ActivityTemplate("What is your age?"), Property = "user.age", AllowInterruptions = AllowInterruptions.Always, @@ -1355,11 +1388,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("I have {user.age} as your age") } }, - new OnIntent() { + new OnIntent() + { Intent = "None", - Actions = new List() { + Actions = new List() + { // short circuiting Interruption so consultation is terminated. new SendActivity("In None..."), + // request the active input step to re-process user input. new SetProperty() { @@ -1394,16 +1430,20 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Generator = new TemplateEngineLanguageGenerator(), Recognizer = new RegexRecognizer() { - Intents = new Dictionary() { + Intents = new Dictionary() + { { "Start", "(?i)start" } } }, Events = new List() { - new OnIntent() { + new OnIntent() + { Intent = "Start", - Actions = new List() { - new NumberInput() { + Actions = new List() + { + new NumberInput() + { Prompt = new ActivityTemplate("What is your age?"), Property = "user.age", AllowInterruptions = AllowInterruptions.NotRecognized, @@ -1417,11 +1457,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("I have {user.age} as your age") } }, - new OnIntent() { + new OnIntent() + { Intent = "None", - Actions = new List() { + Actions = new List() + { // short circuiting Interruption so consultation is terminated. new SendActivity("In None..."), + // request the active input step to re-process user input. new SetProperty() { @@ -1453,16 +1496,20 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Generator = new TemplateEngineLanguageGenerator(), Recognizer = new RegexRecognizer() { - Intents = new Dictionary() { + Intents = new Dictionary() + { { "Start", "(?i)start" } } }, Events = new List() { - new OnIntent() { + new OnIntent() + { Intent = "Start", - Actions = new List() { - new NumberInput() { + Actions = new List() + { + new NumberInput() + { Prompt = new ActivityTemplate("What is your age?"), Property = "user.age", AllowInterruptions = AllowInterruptions.Always, @@ -1471,11 +1518,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("I have {user.age} as your age") } }, - new OnIntent() { + new OnIntent() + { Intent = "None", - Actions = new List() { + Actions = new List() + { // short circuiting Interruption so consultation is terminated. new SendActivity("In None..."), + // request the active input step to re-process user input. new SetProperty() { @@ -1510,16 +1560,20 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Generator = new TemplateEngineLanguageGenerator(), Recognizer = new RegexRecognizer() { - Intents = new Dictionary() { + Intents = new Dictionary() + { { "Start", "(?i)start" } } }, Events = new List() { - new OnIntent() { + new OnIntent() + { Intent = "Start", - Actions = new List() { - new NumberInput() { + Actions = new List() + { + new NumberInput() + { Prompt = new ActivityTemplate("What is your age?"), Property = "user.age", AllowInterruptions = AllowInterruptions.NotRecognized, @@ -1528,11 +1582,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("I have {user.age} as your age") } }, - new OnIntent() { + new OnIntent() + { Intent = "None", - Actions = new List() { + Actions = new List() + { // short circuiting Interruption so consultation is terminated. new SendActivity("In None..."), + // request the active input step to re-process user input. new SetProperty() { @@ -1566,16 +1623,20 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Generator = new TemplateEngineLanguageGenerator(), Recognizer = new RegexRecognizer() { - Intents = new Dictionary() { + Intents = new Dictionary() + { { "Start", "(?i)start" } } }, Events = new List() { - new OnIntent() { + new OnIntent() + { Intent = "Start", - Actions = new List() { - new NumberInput() { + Actions = new List() + { + new NumberInput() + { Prompt = new ActivityTemplate("What is your age?"), Property = "user.age", AllowInterruptions = AllowInterruptions.Never, @@ -1583,11 +1644,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("I have {user.age} as your age") } }, - new OnIntent() { + new OnIntent() + { Intent = "None", - Actions = new List() { + Actions = new List() + { // short circuiting Interruption so consultation is terminated. new SendActivity("In None..."), + // request the active input step to re-process user input. new SetProperty() { @@ -1619,16 +1683,20 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Generator = new TemplateEngineLanguageGenerator(), Recognizer = new RegexRecognizer() { - Intents = new Dictionary() { + Intents = new Dictionary() + { { "Start", "(?i)start" } } }, Events = new List() { - new OnIntent() { + new OnIntent() + { Intent = "Start", - Actions = new List() { - new NumberInput() { + Actions = new List() + { + new NumberInput() + { Prompt = new ActivityTemplate("What is your age?"), Property = "user.age", AllowInterruptions = AllowInterruptions.Never, @@ -1637,11 +1705,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("I have {user.age} as your age") } }, - new OnIntent() { + new OnIntent() + { Intent = "None", - Actions = new List() { + Actions = new List() + { // short circuiting Interruption so consultation is terminated. new SendActivity("In None..."), + // request the active input step to re-process user input. new SetProperty() { @@ -1673,16 +1744,20 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Generator = new TemplateEngineLanguageGenerator(), Recognizer = new RegexRecognizer() { - Intents = new Dictionary() { + Intents = new Dictionary() + { { "Start", "(?i)start" } } }, Events = new List() { - new OnIntent() { + new OnIntent() + { Intent = "Start", - Actions = new List() { - new NumberInput() { + Actions = new List() + { + new NumberInput() + { Prompt = new ActivityTemplate("What is your age?"), Property = "user.age", AllowInterruptions = AllowInterruptions.Never, @@ -1696,11 +1771,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("I have {user.age} as your age") } }, - new OnIntent() { + new OnIntent() + { Intent = "None", - Actions = new List() { + Actions = new List() + { // short circuiting Interruption so consultation is terminated. new SendActivity("In None..."), + // request the active input step to re-process user input. new SetProperty() { @@ -1733,16 +1811,20 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Generator = new TemplateEngineLanguageGenerator(), Recognizer = new RegexRecognizer() { - Intents = new Dictionary() { + Intents = new Dictionary() + { { "Start", "(?i)start" } } }, Events = new List() { - new OnIntent() { + new OnIntent() + { Intent = "Start", - Actions = new List() { - new NumberInput() { + Actions = new List() + { + new NumberInput() + { Prompt = new ActivityTemplate("What is your age?"), Property = "user.age", AllowInterruptions = AllowInterruptions.Never, @@ -1752,11 +1834,14 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("I have {user.age} as your age") } }, - new OnIntent() { + new OnIntent() + { Intent = "None", - Actions = new List() { + Actions = new List() + { // short circuiting Interruption so consultation is terminated. new SendActivity("In None..."), + // request the active input step to re-process user input. new SetProperty() { diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/DialogContextStateTests.cs b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/DialogContextStateTests.cs index 170bcb748..8decf5148 100644 --- a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/DialogContextStateTests.cs +++ b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/DialogContextStateTests.cs @@ -314,7 +314,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests new SendActivity("{dialog.name}"), new IfCondition() { - Condition= "dialog.name == 'testDialog'", + Condition = "dialog.name == 'testDialog'", Actions = new List() { new SendActivity("nested dialogCommand {dialog.name}") @@ -406,6 +406,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests { InputBindings = new Dictionary() { { "$zzz", "dialog.name" } }, DefaultResultProperty = "$zzz", + // test output binding from adaptive dialog OutputBinding = "dialog.name", Events = new List() @@ -564,14 +565,17 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests await CreateFlow(testDialog) .SendConversationUpdate() + // d1 .AssertReply("xyz") .AssertReply("xyz") .AssertReply("d1") + // d2 .AssertReply("d1") .AssertReply("xyz") .AssertReply("bbb") + // d3 .AssertReply("d3") .AssertReply("zzz") diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/RecognizerTests.cs b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/RecognizerTests.cs index 8c859a0b8..3d0b4d340 100644 --- a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/RecognizerTests.cs +++ b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/RecognizerTests.cs @@ -139,7 +139,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests { { "en-us", - new RegexRecognizer() { + new RegexRecognizer() + { Intents = new Dictionary() { { "Greeting", "(?i)howdy" }, @@ -149,7 +150,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests }, { "en-gb", - new RegexRecognizer() { + new RegexRecognizer() + { Intents = new Dictionary() { { "Greeting", "(?i)hiya" }, @@ -159,7 +161,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests }, { "en", - new RegexRecognizer() { + new RegexRecognizer() + { Intents = new Dictionary() { { "Greeting", "(?i)hello" }, @@ -169,7 +172,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests }, { "", - new RegexRecognizer() { + new RegexRecognizer() + { Intents = new Dictionary() { { "Greeting", "(?i)salve" }, diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/RegexRecognizerTests.cs b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/RegexRecognizerTests.cs index 5acee5470..4eb96a9de 100644 --- a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/RegexRecognizerTests.cs +++ b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/RegexRecognizerTests.cs @@ -51,6 +51,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests Assert.AreEqual("b2", (string)entities.code[1], "should find b2"); tc = CreateContext("red and orange"); + // intent assertions result = await recognizer.RecognizeAsync(tc, CancellationToken.None); Assert.AreEqual(1, result.Intents.Count, "Should recognize one intent"); diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Composition.Tests/ObjectAssignTests.cs b/tests/Microsoft.Bot.Builder.Dialogs.Composition.Tests/ObjectAssignTests.cs index f9adc67f6..6a2d4f28d 100644 --- a/tests/Microsoft.Bot.Builder.Dialogs.Composition.Tests/ObjectAssignTests.cs +++ b/tests/Microsoft.Bot.Builder.Dialogs.Composition.Tests/ObjectAssignTests.cs @@ -53,7 +53,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Composition { var defaultOptions = new Options() { }; - var overlay= new Options() + var overlay = new Options() { LastName = "Smith", FirstName = "Fred", diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Composition.Tests/TestUtilities.cs b/tests/Microsoft.Bot.Builder.Dialogs.Composition.Tests/TestUtilities.cs index 1dafb3068..761891a7f 100644 --- a/tests/Microsoft.Bot.Builder.Dialogs.Composition.Tests/TestUtilities.cs +++ b/tests/Microsoft.Bot.Builder.Dialogs.Composition.Tests/TestUtilities.cs @@ -26,7 +26,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Composition.Tests }, Conversation = new ConversationAccount() { - Id="213123123123" + Id = "213123123123" } }; var bc = new TurnContext(b, a); diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Debugging.Tests/identifierTests.cs b/tests/Microsoft.Bot.Builder.Dialogs.Debugging.Tests/identifierTests.cs index 3825488f0..12fce7b46 100644 --- a/tests/Microsoft.Bot.Builder.Dialogs.Debugging.Tests/identifierTests.cs +++ b/tests/Microsoft.Bot.Builder.Dialogs.Debugging.Tests/identifierTests.cs @@ -12,7 +12,8 @@ namespace Microsoft.Bot.Builder.Dialogs.Debugging.Tests [TestClass] public sealed class IdentifierTests { - public static IEnumerable Bytes => new[] { + public static IEnumerable Bytes => new[] + { 0ul, 0x7Eul, 0x7Ful, 0x80ul, 0x81ul, 0xFFul, }; diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Declarative.Tests/ResourceExplorerTests.cs b/tests/Microsoft.Bot.Builder.Dialogs.Declarative.Tests/ResourceExplorerTests.cs index 4531070b9..d3768712d 100644 --- a/tests/Microsoft.Bot.Builder.Dialogs.Declarative.Tests/ResourceExplorerTests.cs +++ b/tests/Microsoft.Bot.Builder.Dialogs.Declarative.Tests/ResourceExplorerTests.cs @@ -187,6 +187,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Declarative.Tests changeFired.SetResult(true); } }; + // changed file File.Delete(testDialogFile); diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Tests/TextMessageGeneratorTests.cs b/tests/Microsoft.Bot.Builder.Dialogs.Tests/TextMessageGeneratorTests.cs index 179387ca6..3a226533c 100644 --- a/tests/Microsoft.Bot.Builder.Dialogs.Tests/TextMessageGeneratorTests.cs +++ b/tests/Microsoft.Bot.Builder.Dialogs.Tests/TextMessageGeneratorTests.cs @@ -112,6 +112,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Tests Assert.AreEqual(3, card.Buttons.Count, "card buttons should be set"); for (int i = 0; i <= 2; i++) Assert.AreEqual($"Option {i + 1}", card.Buttons[i].Title, "card buttons should be set"); + // TODO add all of the other property types } @@ -138,6 +139,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Tests Assert.AreEqual(3, card.Buttons.Count, "card buttons should be set"); for (int i = 0; i <= 2; i++) Assert.AreEqual($"Option {i + 1}", card.Buttons[i].Title, "card buttons should be set"); + // TODO add all of the other property types } @@ -168,6 +170,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Tests Assert.AreEqual(3, card.Buttons.Count, "card buttons should be set"); for (int i = 0; i <= 2; i++) Assert.AreEqual($"Option {i + 1}", card.Buttons[i].Title, "card buttons should be set"); + // TODO add all of the other property types } diff --git a/tests/Microsoft.Bot.Builder.Expressions.Tests/BadExpressionTests.cs b/tests/Microsoft.Bot.Builder.Expressions.Tests/BadExpressionTests.cs index 58a6941ee..d95e20126 100644 --- a/tests/Microsoft.Bot.Builder.Expressions.Tests/BadExpressionTests.cs +++ b/tests/Microsoft.Bot.Builder.Expressions.Tests/BadExpressionTests.cs @@ -15,6 +15,10 @@ namespace Microsoft.Bot.Builder.Expressions.Tests /// Gets or sets the test context which provides /// information about and functionality for the current test run. /// + /// + /// The test context which provides + /// information about and functionality for the current test run. + /// public TestContext TestContext { get { return testContextInstance; } @@ -133,6 +137,7 @@ namespace Microsoft.Bot.Builder.Expressions.Tests Test("lessOrEquals(one)"), // function need two parameters Test("equals(one)"), // equals must accept two parameters Test("exists(1, 2)"), // function need one parameter + //Test("if(!exists(one), one, hello)"), // the second and third parameters of if must the same type Test("not(false, one)"), // function need one parameter # endregion diff --git a/tests/Microsoft.Bot.Builder.Expressions.Tests/ExpressionEngineTests.cs b/tests/Microsoft.Bot.Builder.Expressions.Tests/ExpressionEngineTests.cs index cecbd1cab..62ece840b 100644 --- a/tests/Microsoft.Bot.Builder.Expressions.Tests/ExpressionEngineTests.cs +++ b/tests/Microsoft.Bot.Builder.Expressions.Tests/ExpressionEngineTests.cs @@ -15,7 +15,7 @@ namespace Microsoft.Bot.Builder.Expressions.Tests public static HashSet one = new HashSet { "one" }; public static HashSet oneTwo = new HashSet { "one", "two" }; - private static readonly string nullStr = null; + private static readonly string NullStr = null; private readonly object scope = new Dictionary { @@ -26,8 +26,9 @@ namespace Microsoft.Bot.Builder.Expressions.Tests { "cit", "cit" }, { "y", "y" }, { "istrue", true }, - { "nullObj", nullStr }, - { "bag", new Dictionary + { "nullObj", NullStr }, + { + "bag", new Dictionary { { "three", 3.0 }, { "set", new { four = 4.0 } }, @@ -37,7 +38,8 @@ namespace Microsoft.Bot.Builder.Expressions.Tests } }, { "items", new string[] { "zero", "one", "two" } }, - { "nestedItems", + { + "nestedItems", new[] { new { x = 1 }, @@ -45,7 +47,8 @@ namespace Microsoft.Bot.Builder.Expressions.Tests new { x = 3 } } }, - { "user", + { + "user", new { lists = new @@ -65,7 +68,8 @@ namespace Microsoft.Bot.Builder.Expressions.Tests { "timestampObj", DateTime.Parse("2018-03-15T13:00:00.000Z").ToUniversalTime() }, { "unixTimestamp", 1521118800 }, { "xmlStr", " Gala apple 20 Honeycrisp apple 10 " }, - { "jsonStr", @"{ + { + "jsonStr", @"{ 'Stores': [ 'Lambton Quay', 'Willis Street' @@ -95,7 +99,8 @@ namespace Microsoft.Bot.Builder.Expressions.Tests } ] }"}, - { "turn", new + { + "turn", new { recognized = new { @@ -161,7 +166,8 @@ namespace Microsoft.Bot.Builder.Expressions.Tests } } }, - { "dialog", + { + "dialog", new { x=3, @@ -182,7 +188,8 @@ namespace Microsoft.Bot.Builder.Expressions.Tests subTitle = "Dialog Sub Title" } }, - { "callstack", new object[] + { + "callstack", new object[] { new { @@ -460,6 +467,7 @@ namespace Microsoft.Bot.Builder.Expressions.Tests # endregion # region Date and time function test + //init dateTime: 2018-03-15T13:00:00Z Test("addDays(timestamp, 1)", "2018-03-16T13:00:00.000Z"), Test("addDays(timestamp, 1,'MM-dd-yy')", "03-16-18"), @@ -618,6 +626,7 @@ namespace Microsoft.Bot.Builder.Expressions.Tests Test("$x", 3), Test("$y", 2), Test("$z", 1), + // Test("^x", 3), // Test("^y", 2), // Test("^z", 1), diff --git a/tests/Microsoft.Bot.Builder.Expressions.Tests/LRUCacheTest.cs b/tests/Microsoft.Bot.Builder.Expressions.Tests/LRUCacheTest.cs index b58c0cafa..cae7feb7e 100644 --- a/tests/Microsoft.Bot.Builder.Expressions.Tests/LRUCacheTest.cs +++ b/tests/Microsoft.Bot.Builder.Expressions.Tests/LRUCacheTest.cs @@ -55,7 +55,8 @@ namespace Microsoft.Bot.Builder.Expressions.Tests var fib9999 = 1242044891; var fib100000 = 2132534333; var maxIdx = 10000; - for (int i = 2; i <= maxIdx; i++) { + for (int i = 2; i <= maxIdx; i++) + { cache.TryGet(i - 2, out var prev2); cache.TryGet(i - 1, out var prev1); cache.Set(i, prev1 + prev2); @@ -63,7 +64,7 @@ namespace Microsoft.Bot.Builder.Expressions.Tests Assert.IsFalse(cache.TryGet(9998, out var result)); - Assert.IsTrue(cache.TryGet(maxIdx-1, out result)); + Assert.IsTrue(cache.TryGet(maxIdx - 1, out result)); Assert.AreEqual(result, fib9999); Assert.IsTrue(cache.TryGet(maxIdx, out result)); diff --git a/tests/Microsoft.Bot.Builder.LanguageGeneration.Tests/TemplateEngineTest.cs b/tests/Microsoft.Bot.Builder.LanguageGeneration.Tests/TemplateEngineTest.cs index c64b69c2a..4607787ed 100644 --- a/tests/Microsoft.Bot.Builder.LanguageGeneration.Tests/TemplateEngineTest.cs +++ b/tests/Microsoft.Bot.Builder.LanguageGeneration.Tests/TemplateEngineTest.cs @@ -285,7 +285,8 @@ namespace Microsoft.Bot.Builder.AI.LanguageGeneration.Tests public void TestAnalyzer() { var testData = new object[] - { new + { + new { name = "orderReadOut", variableOptions = new string[] { "orderType", "userName", "base", "topping", "bread", "meat" }, @@ -300,6 +301,7 @@ namespace Microsoft.Bot.Builder.AI.LanguageGeneration.Tests new { name = "template1", + // TODO: input.property should really be: customer.property but analyzer needs to be variableOptions = new string[] { "alarms", "customer", "tasks[0]", "age", "city" }, templateRefOptions = new string[] { "template2", "template3", "template4", "template5", "template6" } diff --git a/tests/Microsoft.Bot.Builder.LanguageGeneration.Tests/TemplateEngineThrowExceptionTest.cs b/tests/Microsoft.Bot.Builder.LanguageGeneration.Tests/TemplateEngineThrowExceptionTest.cs index e83dde7e1..bc4738bed 100644 --- a/tests/Microsoft.Bot.Builder.LanguageGeneration.Tests/TemplateEngineThrowExceptionTest.cs +++ b/tests/Microsoft.Bot.Builder.LanguageGeneration.Tests/TemplateEngineThrowExceptionTest.cs @@ -13,6 +13,10 @@ namespace Microsoft.Bot.Builder.AI.LanguageGeneration.Tests /// Gets or sets the test context which provides /// information about and functionality for the current test run. /// + /// + /// The test context which provides + /// information about and functionality for the current test run. + /// public TestContext TestContext { get; set; } private string GetExampleFilePath(string fileName) diff --git a/tests/Microsoft.Bot.Builder.TemplateManager/TemplateManagerTests.cs b/tests/Microsoft.Bot.Builder.TemplateManager/TemplateManagerTests.cs index dcc53a581..b1506aadd 100644 --- a/tests/Microsoft.Bot.Builder.TemplateManager/TemplateManagerTests.cs +++ b/tests/Microsoft.Bot.Builder.TemplateManager/TemplateManagerTests.cs @@ -135,7 +135,8 @@ namespace Microsoft.Bot.Builder.TemplateManager.Tests var templateManager = new TemplateManager() { - Renderers = { + Renderers = + { new DictionaryRenderer(templates1), new DictionaryRenderer(templates2) } diff --git a/tests/Microsoft.Bot.Builder.TestBot.Json/CustomSteps/JavascriptStep.cs b/tests/Microsoft.Bot.Builder.TestBot.Json/CustomSteps/JavascriptStep.cs index 1e76982f0..ca43c702e 100644 --- a/tests/Microsoft.Bot.Builder.TestBot.Json/CustomSteps/JavascriptStep.cs +++ b/tests/Microsoft.Bot.Builder.TestBot.Json/CustomSteps/JavascriptStep.cs @@ -18,7 +18,7 @@ namespace Microsoft.Bot.Builder.TestBot.Json private string script; /// - /// Javascript bound to memory run function(user, conversation, dialog, turn). + /// Gets or sets javascript bound to memory run function(user, conversation, dialog, turn). /// /// /// example inline script: @@ -32,6 +32,9 @@ namespace Microsoft.Bot.Builder.TestBot.Json /// return 0; /// }. /// + /// + /// Javascript bound to memory run function(user, conversation, dialog, turn). + /// public string Script { get { return script; } set { LoadScript(value); } } [JsonConstructor] diff --git a/tests/Microsoft.Bot.Builder.TestBot.Json/CustomSteps/MultiplyStep.cs b/tests/Microsoft.Bot.Builder.TestBot.Json/CustomSteps/MultiplyStep.cs index f2a795ac8..363b8e63b 100644 --- a/tests/Microsoft.Bot.Builder.TestBot.Json/CustomSteps/MultiplyStep.cs +++ b/tests/Microsoft.Bot.Builder.TestBot.Json/CustomSteps/MultiplyStep.cs @@ -26,20 +26,29 @@ namespace Microsoft.Bot.Builder.TestBot.Json } /// - /// memory path to bind to arg1 (ex: conversation.width). + /// Gets or sets memory path to bind to arg1 (ex: conversation.width). /// + /// + /// memory path to bind to arg1 (ex: conversation.width). + /// [JsonProperty("arg1")] public string Arg1 { get { return this.InputBindings["arg1"]; } set { this.InputBindings["arg1"] = value; } } /// - /// memory path to bind to arg2 (ex: conversation.height). + /// Gets or sets memory path to bind to arg2 (ex: conversation.height). /// + /// + /// memory path to bind to arg2 (ex: conversation.height). + /// [JsonProperty("arg2")] public string Arg2 { get { return this.InputBindings["arg2"]; } set { this.InputBindings["arg2"] = value; } } /// - /// caller's memory path to store the result of this step in (ex: conversation.area). + /// Gets or sets caller's memory path to store the result of this step in (ex: conversation.area). /// + /// + /// caller's memory path to store the result of this step in (ex: conversation.area). + /// [JsonProperty("result")] public string Result { get { return this.OutputBinding; } set { this.OutputBinding = value; } } diff --git a/tests/Microsoft.Bot.Builder.Tests/TranscriptBaseTests.cs b/tests/Microsoft.Bot.Builder.Tests/TranscriptBaseTests.cs index 95ddb24bd..fe6b3b523 100644 --- a/tests/Microsoft.Bot.Builder.Tests/TranscriptBaseTests.cs +++ b/tests/Microsoft.Bot.Builder.Tests/TranscriptBaseTests.cs @@ -144,6 +144,7 @@ namespace Microsoft.Bot.Builder.Tests ServiceUrl = activities[1].ServiceUrl, }; await Store.LogActivityAsync(deleteActivity); + // tombstone the deleted record activities[1] = new Activity() { diff --git a/tests/Microsoft.Bot.Builder.Tests/Transcript_MiddlewareTests.cs b/tests/Microsoft.Bot.Builder.Tests/Transcript_MiddlewareTests.cs index 7b49e089b..bbd0727a3 100644 --- a/tests/Microsoft.Bot.Builder.Tests/Transcript_MiddlewareTests.cs +++ b/tests/Microsoft.Bot.Builder.Tests/Transcript_MiddlewareTests.cs @@ -214,12 +214,14 @@ namespace Microsoft.Bot.Builder.Tests Assert.AreEqual("foo", pagedResult.Items[0].AsMessageActivity().Text); Assert.AreEqual("new response", pagedResult.Items[1].AsMessageActivity().Text); Assert.AreEqual("update", pagedResult.Items[2].AsMessageActivity().Text); + // Perform some queries pagedResult = await transcriptStore.GetTranscriptActivitiesAsync(conversation.ChannelId, conversation.Conversation.Id, null, DateTimeOffset.MinValue); Assert.AreEqual(3, pagedResult.Items.Length); Assert.AreEqual("foo", pagedResult.Items[0].AsMessageActivity().Text); Assert.AreEqual("new response", pagedResult.Items[1].AsMessageActivity().Text); Assert.AreEqual("update", pagedResult.Items[2].AsMessageActivity().Text); + // Perform some queries pagedResult = await transcriptStore.GetTranscriptActivitiesAsync(conversation.ChannelId, conversation.Conversation.Id, null, DateTimeOffset.MaxValue); Assert.AreEqual(0, pagedResult.Items.Length);