rename CompositionRoot to Conversation

This commit is contained in:
Will Portnoy 2016-03-26 12:33:51 -07:00
Родитель ceb6e6afc9
Коммит 7d4937870b
10 изменённых файлов: 18 добавлений и 15 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -46,7 +46,10 @@ using Microsoft.Bot.Connector;
namespace Microsoft.Bot.Builder
{
public static partial class CompositionRoot
/// <summary>
/// The top level composition root for the SDK.
/// </summary>
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;

Просмотреть файл

@ -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
{

Просмотреть файл

@ -22,7 +22,7 @@ namespace Microsoft.Bot.Sample.EchoBot
/// </summary>
public async Task<Message> Post([FromBody]Message message)
{
return await CompositionRoot.SendAsync(message, () => new EchoDialog());
return await Conversation.SendAsync(message, () => new EchoDialog());
}
}
}

Просмотреть файл

@ -56,7 +56,7 @@ namespace Microsoft.Bot.Sample.PizzaBot
/// </summary>
public async Task<Message> Post([FromBody]Message message)
{
return await CompositionRoot.SendAsync(message, MakeRoot);
return await Conversation.SendAsync(message, MakeRoot);
}
}
}

Просмотреть файл

@ -22,7 +22,7 @@ namespace Microsoft.Bot.Sample.SimpleAlarmBot
/// </summary>
public async Task<Message> Post([FromBody]Message message)
{
return await CompositionRoot.SendAsync(message, () => new SimpleAlarmBot());
return await Conversation.SendAsync(message, () => new SimpleAlarmBot());
}
// ------ to send a message

Просмотреть файл

@ -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
{

Просмотреть файл

@ -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)

Просмотреть файл

@ -100,7 +100,7 @@ namespace Microsoft.Bot.Builder.Tests
public static void AssertSerializable<T>(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();

Просмотреть файл

@ -60,7 +60,7 @@ namespace Microsoft.Bot.Sample.Tests
Func<IDialog> 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"));
}
}