Esempio n. 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");
        }
Esempio n. 2
0
        public virtual void Initialize()
        {
            this.Configuration = new BuildConfig().Configuration;

            var builder = new ContainerBuilder();

            builder.RegisterInstance <IConfiguration>(this.Configuration);

            this.Container = builder.Build();

            this.BotResponseBuilder = new BotResponseBuilder();
            this.BotResponseBuilder.AddFormatter(new TextBotResponseFormatter());
        }
Esempio n. 3
0
        private static BotResponseBuilder BotResponseBuilder()
        {
            var responseBuilder = new BotResponseBuilder();

            return(responseBuilder);
        }
Esempio n. 4
0
        public static Activity CreateAdaptiveCardReply <T>(this Activity activity, BotResponse response, string cardPath, T cardDataAdapter, BotResponseBuilder responseBuilder = null, StringDictionary tokens = null, Activity replyToUse = null)
            where T : CardDataBase
        {
            var reply = replyToUse ?? activity.CreateReply();

            if (responseBuilder == null)
            {
                responseBuilder = BotResponseBuilder();
            }

            responseBuilder.BuildAdaptiveCardReply(reply, response, cardPath, cardDataAdapter, tokens);
            return(reply);
        }
Esempio n. 5
0
        public static Activity CreateAdaptiveCardGroupReply <T>(this Activity activity, BotResponse response, string cardPath, string attachmentLayout, List <T> cardDataAdapters, BotResponseBuilder responseBuilder = null, StringDictionary tokens = null)
            where T : CardDataBase
        {
            var reply = activity.CreateReply();

            if (responseBuilder == null)
            {
                responseBuilder = BotResponseBuilder();
            }

            responseBuilder.BuildAdaptiveCardGroupReply(reply, response, cardPath, attachmentLayout, cardDataAdapters, tokens);
            return(reply);
        }
Esempio n. 6
0
        public static Activity CreateReply(this Activity activity, BotResponse response, BotResponseBuilder responseBuilder = null, StringDictionary tokens = null)
        {
            var reply = activity.CreateReply();

            if (responseBuilder == null)
            {
                responseBuilder = BotResponseBuilder();
            }

            responseBuilder.BuildMessageReply(reply, response, tokens);
            return(reply);
        }