From 7d4937870b7134a0c7bd846a03f8c44f701e7c2c Mon Sep 17 00:00:00 2001 From: Will Portnoy Date: Sat, 26 Mar 2016 12:33:51 -0700 Subject: [PATCH] rename CompositionRoot to Conversation --- CSharp/Documentation/Overview.cs | 2 +- CSharp/Library/Dialogs/CompositionRoot.cs | 7 +++++-- .../Controllers/MessagesController.cs | 2 +- .../Samples/EchoBot/Controllers/MessagesController.cs | 2 +- .../Samples/PizzaBot/Controllers/MessagesController.cs | 2 +- .../SimpleAlarmBot/Controllers/MessagesController.cs | 2 +- .../Controllers/MessagesController.cs | 2 +- CSharp/Tests/FormTest/Program.cs | 2 +- CSharp/Tests/Microsoft.Bot.Builder.Tests/FiberTests.cs | 2 +- .../Tests/Microsoft.Bot.Sample.Tests/EchoBotTests.cs | 10 +++++----- 10 files changed, 18 insertions(+), 15 deletions(-) diff --git a/CSharp/Documentation/Overview.cs b/CSharp/Documentation/Overview.cs index 93c34ef59..399592f20 100644 --- a/CSharp/Documentation/Overview.cs +++ b/CSharp/Documentation/Overview.cs @@ -59,7 +59,7 @@ namespace Microsoft.Bot.Builder /// web server's memory). /// /// \subsection Execution Flow - /// CompositionRoot.SendAsync is the top level method for the %Bot Builder SDK. The composition root follows the dependency + /// Conversation.SendAsync is the top level method for the %Bot Builder SDK. This composition root follows the dependency /// inversion principle (https://en.wikipedia.org/wiki/Dependency_inversion_principle), and performs this work: /// /// - instantiates the required components diff --git a/CSharp/Library/Dialogs/CompositionRoot.cs b/CSharp/Library/Dialogs/CompositionRoot.cs index be6e4b027..3d5954199 100644 --- a/CSharp/Library/Dialogs/CompositionRoot.cs +++ b/CSharp/Library/Dialogs/CompositionRoot.cs @@ -46,7 +46,10 @@ using Microsoft.Bot.Connector; namespace Microsoft.Bot.Builder { - public static partial class CompositionRoot + /// + /// The top level composition root for the SDK. + /// + public static partial class Conversation { private const string BlobKey = "DialogState"; @@ -71,7 +74,7 @@ namespace Microsoft.Bot.Builder { waits, frames, toBotData, client }; - var formatter = CompositionRoot.MakeBinaryFormatter(provider); + var formatter = Conversation.MakeBinaryFormatter(provider); Internals.DialogContext context; diff --git a/CSharp/Samples/AnnotatedSandwichBot/Controllers/MessagesController.cs b/CSharp/Samples/AnnotatedSandwichBot/Controllers/MessagesController.cs index dd9b03a77..cb09db7bf 100644 --- a/CSharp/Samples/AnnotatedSandwichBot/Controllers/MessagesController.cs +++ b/CSharp/Samples/AnnotatedSandwichBot/Controllers/MessagesController.cs @@ -29,7 +29,7 @@ namespace Microsoft.Bot.Sample.AnnotatedSandwichBot { if (message.Type == "Message") { - return await CompositionRoot.SendAsync(message, MakeRoot); + return await Conversation.SendAsync(message, MakeRoot); } else { diff --git a/CSharp/Samples/EchoBot/Controllers/MessagesController.cs b/CSharp/Samples/EchoBot/Controllers/MessagesController.cs index ea79d3e18..3068559b9 100644 --- a/CSharp/Samples/EchoBot/Controllers/MessagesController.cs +++ b/CSharp/Samples/EchoBot/Controllers/MessagesController.cs @@ -22,7 +22,7 @@ namespace Microsoft.Bot.Sample.EchoBot /// public async Task Post([FromBody]Message message) { - return await CompositionRoot.SendAsync(message, () => new EchoDialog()); + return await Conversation.SendAsync(message, () => new EchoDialog()); } } } diff --git a/CSharp/Samples/PizzaBot/Controllers/MessagesController.cs b/CSharp/Samples/PizzaBot/Controllers/MessagesController.cs index b3bd5e2f2..4f7f83c8a 100644 --- a/CSharp/Samples/PizzaBot/Controllers/MessagesController.cs +++ b/CSharp/Samples/PizzaBot/Controllers/MessagesController.cs @@ -56,7 +56,7 @@ namespace Microsoft.Bot.Sample.PizzaBot /// public async Task Post([FromBody]Message message) { - return await CompositionRoot.SendAsync(message, MakeRoot); + return await Conversation.SendAsync(message, MakeRoot); } } } \ No newline at end of file diff --git a/CSharp/Samples/SimpleAlarmBot/Controllers/MessagesController.cs b/CSharp/Samples/SimpleAlarmBot/Controllers/MessagesController.cs index 9a69c7683..928da9e71 100644 --- a/CSharp/Samples/SimpleAlarmBot/Controllers/MessagesController.cs +++ b/CSharp/Samples/SimpleAlarmBot/Controllers/MessagesController.cs @@ -22,7 +22,7 @@ namespace Microsoft.Bot.Sample.SimpleAlarmBot /// public async Task Post([FromBody]Message message) { - return await CompositionRoot.SendAsync(message, () => new SimpleAlarmBot()); + return await Conversation.SendAsync(message, () => new SimpleAlarmBot()); } // ------ to send a message diff --git a/CSharp/Samples/SimpleSandwichBot/Controllers/MessagesController.cs b/CSharp/Samples/SimpleSandwichBot/Controllers/MessagesController.cs index 817ac486c..529c22782 100644 --- a/CSharp/Samples/SimpleSandwichBot/Controllers/MessagesController.cs +++ b/CSharp/Samples/SimpleSandwichBot/Controllers/MessagesController.cs @@ -29,7 +29,7 @@ namespace Microsoft.Bot.Sample.SimpleSandwichBot { if (message.Type == "Message") { - return await CompositionRoot.SendAsync(message, MakeRoot); + return await Conversation.SendAsync(message, MakeRoot); } else { diff --git a/CSharp/Tests/FormTest/Program.cs b/CSharp/Tests/FormTest/Program.cs index bb586eeb9..3e3565d8a 100644 --- a/CSharp/Tests/FormTest/Program.cs +++ b/CSharp/Tests/FormTest/Program.cs @@ -66,7 +66,7 @@ namespace Microsoft.Bot.Builder.FormTest string prompt; do { - var task = CompositionRoot.SendAsync(message, () => form); + var task = Conversation.SendAsync(message, () => form); message = task.GetAwaiter().GetResult(); prompt = message.Text; if (prompt != null) diff --git a/CSharp/Tests/Microsoft.Bot.Builder.Tests/FiberTests.cs b/CSharp/Tests/Microsoft.Bot.Builder.Tests/FiberTests.cs index 05e36ad5f..5644b50e3 100644 --- a/CSharp/Tests/Microsoft.Bot.Builder.Tests/FiberTests.cs +++ b/CSharp/Tests/Microsoft.Bot.Builder.Tests/FiberTests.cs @@ -100,7 +100,7 @@ namespace Microsoft.Bot.Builder.Tests public static void AssertSerializable(ref T item, params object[] instances) where T : class { - var formatter = CompositionRoot.MakeBinaryFormatter(new Serialization.SimpleServiceLocator(instances)); + var formatter = Conversation.MakeBinaryFormatter(new Serialization.SimpleServiceLocator(instances)); //var surrogate = new Surrogate(); //var selector = new SurrogateSelector(); diff --git a/CSharp/Tests/Microsoft.Bot.Sample.Tests/EchoBotTests.cs b/CSharp/Tests/Microsoft.Bot.Sample.Tests/EchoBotTests.cs index 0073eb353..ca0dd70d3 100644 --- a/CSharp/Tests/Microsoft.Bot.Sample.Tests/EchoBotTests.cs +++ b/CSharp/Tests/Microsoft.Bot.Sample.Tests/EchoBotTests.cs @@ -60,7 +60,7 @@ namespace Microsoft.Bot.Sample.Tests Func MakeRoot = () => new EchoDialog(); // act: sending the message - var toUser = await CompositionRoot.SendAsync(toBot, MakeRoot); + var toUser = await Conversation.SendAsync(toBot, MakeRoot); // assert: check if the dialog returned the right response Assert.IsTrue(toUser.Text.StartsWith("0")); @@ -73,7 +73,7 @@ namespace Microsoft.Bot.Sample.Tests toBot = toUser; // post the message - toUser = await CompositionRoot.SendAsync(toBot, MakeRoot); + toUser = await Conversation.SendAsync(toBot, MakeRoot); } // assert: check the counter at the end @@ -82,7 +82,7 @@ namespace Microsoft.Bot.Sample.Tests // act: send the reset toBot = toUser; toBot.Text = "reset"; - toUser = await CompositionRoot.SendAsync(toBot, MakeRoot); + toUser = await Conversation.SendAsync(toBot, MakeRoot); // assert: verify confirmation Assert.IsTrue(toUser.Text.ToLower().Contains("are you sure")); @@ -90,13 +90,13 @@ namespace Microsoft.Bot.Sample.Tests //send yes as reply toBot = toUser; toBot.Text = "yes"; - toUser = await CompositionRoot.SendAsync(toBot, MakeRoot); + toUser = await Conversation.SendAsync(toBot, MakeRoot); Assert.IsTrue(toUser.Text.ToLower().Contains("count reset")); //send a random message and check count toBot = toUser; toBot.Text = "test"; - toUser = await CompositionRoot.SendAsync(toBot, MakeRoot); + toUser = await Conversation.SendAsync(toBot, MakeRoot); Assert.IsTrue(toUser.Text.StartsWith("0")); } }