Example #1
0
        public new void Initialize()
        {
            var builder = new ContainerBuilder();

            ConversationState   = new ConversationState(new MemoryStorage());
            DialogState         = ConversationState.CreateProperty <DialogState>(nameof(DialogState));
            UserState           = new UserState(new MemoryStorage());
            TelemetryClient     = new NullBotTelemetryClient();
            SkillConfigurations = new Dictionary <string, SkillConfigurationBase>();

            // Add the LUIS model fakes used by the Skill
            Services = new MockSkillConfiguration();
            Services.LocaleConfigurations.Add("en", new LocaleConfiguration()
            {
                Locale       = "en-us",
                LuisServices = new Dictionary <string, ITelemetryLuisRecognizer>
                {
                    { "general", GeneralTestUtil.CreateRecognizer() },
                    { "FakeSkill", FakeSkillTestUtil.CreateRecognizer() }
                }
            });

            Services.LocaleConfigurations.Add("es", new LocaleConfiguration()
            {
                Locale       = "es-mx",
                LuisServices = new Dictionary <string, ITelemetryLuisRecognizer>
                {
                    { "general", GeneralTestUtil.CreateRecognizer() },
                    { "FakeSkill", FakeSkillTestUtil.CreateRecognizer() }
                }
            });

            // Dummy Authentication connection for Auth testing
            Services.AuthenticationConnections = new Dictionary <string, string>
            {
                { "DummyAuth", "DummyAuthConnection" }
            };

            builder.RegisterInstance(new BotStateSet(UserState, ConversationState));
            Container = builder.Build();

            BotResponseBuilder = new BotResponseBuilder();
            BotResponseBuilder.AddFormatter(new TextBotResponseFormatter());

            Dialogs = new DialogSet(DialogState);

            // Manually mange the conversation metadata when we need finer grained control
            ConversationReference = new ConversationReference
            {
                ChannelId  = "test",
                ServiceUrl = "https://test.com",
            };

            ConversationReference.User         = new ChannelAccount("user1", "User1");
            ConversationReference.Bot          = new ChannelAccount("bot", "Bot");
            ConversationReference.Conversation = new ConversationAccount(false, "convo1", "Conversation1");
        }
Example #2
0
        public new void Initialize()
        {
            var builder = new ContainerBuilder();

            ConversationState   = new ConversationState(new MemoryStorage());
            DialogState         = ConversationState.CreateProperty <DialogState>(nameof(DialogState));
            UserState           = new UserState(new MemoryStorage());
            ProactiveState      = new ProactiveState(new MemoryStorage());
            TelemetryClient     = new NullBotTelemetryClient();
            BackgroundTaskQueue = new BackgroundTaskQueue();
            EndpointService     = new EndpointService();
            SkillConfigurations = new Dictionary <string, SkillConfigurationBase>();

            // Add the LUIS model fakes used by the Skill
            Services = new MockSkillConfiguration();
            Services.LocaleConfigurations.Add("en", new LocaleConfiguration()
            {
                Locale       = "en-us",
                LuisServices = new Dictionary <string, ITelemetryLuisRecognizer>
                {
                    { "general", GeneralTestUtil.CreateRecognizer() },
                    { "FakeSkill", FakeSkillTestUtil.CreateRecognizer() }
                }
            });

            Services.LocaleConfigurations.Add("es", new LocaleConfiguration()
            {
                Locale       = "es-mx",
                LuisServices = new Dictionary <string, ITelemetryLuisRecognizer>
                {
                    { "general", GeneralTestUtil.CreateRecognizer() },
                    { "FakeSkill", FakeSkillTestUtil.CreateRecognizer() }
                }
            });

            // Dummy Authentication connection for Auth testing
            Services.AuthenticationConnections = new Dictionary <string, string>
            {
                { "DummyAuth", "DummyAuthConnection" }
            };

            builder.RegisterInstance(new BotStateSet(UserState, ConversationState));
            Container = builder.Build();

            Dialogs = new DialogSet(DialogState);

            ResponseManager = new ResponseManager(
                new IResponseIdCollection[]
            {
                new SampleAuthResponses(),
                new MainResponses(),
                new SharedResponses(),
                new SampleResponses()
            },
                new string[] { "en-us", "de-de", "es-es", "fr-fr", "it-it", "zh-cn" });

            // Manually mange the conversation metadata when we need finer grained control
            ConversationReference = new ConversationReference
            {
                ChannelId  = "test",
                ServiceUrl = "https://test.com",
            };

            ConversationReference.User         = new ChannelAccount("user1", "User1");
            ConversationReference.Bot          = new ChannelAccount("bot", "Bot");
            ConversationReference.Conversation = new ConversationAccount(false, "convo1", "Conversation1");
        }