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

            ConversationState = new ConversationState(new MemoryStorage());
            UserState         = new UserState(new MemoryStorage());
            TelemetryClient   = new NullBotTelemetryClient();
            Services          = new MockSkillConfiguration();

            builder.RegisterInstance(new BotStateSet(UserState, ConversationState));
            var fakeServiceManager = new MockServiceManager();

            builder.RegisterInstance <IServiceManager>(fakeServiceManager);

            this.Container           = builder.Build();
            this.ServiceManager      = fakeServiceManager;
            this.EndpointService     = new EndpointService();
            this.BackgroundTaskQueue = new BackgroundTaskQueue();
            this.ProactiveState      = new ProactiveState(new MemoryStorage());

            ResponseManager = new ResponseManager(
                responseTemplates: new IResponseIdCollection[]
            {
                new POISharedResponses(),
                new RouteResponses(),
                new CancelRouteResponses()
            },
                locales: new string[] { "en-us", "de-de", "es-es", "fr-fr", "it-it", "zh-cn" });
        }
Beispiel #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());
            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");
        }
Beispiel #3
0
        public StepHelperTests()
            : base(DialogId)
        {
            Services = new MockSkillConfiguration();

            this.mockEmailStateAccessor = new MockEmailStateAccessor();
            EmailStateAccessor          = mockEmailStateAccessor.GetMock().Object;

            this.mockDialogStateAccessor = new MockDialogStateAccessor();
            DialogStateAccessor          = mockDialogStateAccessor.GetMock().Object;

            ServiceManager = new MockServiceManager();
        }
Beispiel #4
0
        public override void Initialize()
        {
            var builder = new ContainerBuilder();

            ConversationState            = new ConversationState(new MemoryStorage());
            UserState                    = new UserState(new MemoryStorage());
            ProactiveState               = new ProactiveState(new MemoryStorage());
            AutomotiveSkillStateAccessor = ConversationState.CreateProperty <AutomotiveSkillState>(nameof(AutomotiveSkillState));
            Services            = new MockSkillConfiguration();
            BackgroundTaskQueue = new BackgroundTaskQueue();
            EndpointService     = new EndpointService();

            ResponseManager = new ResponseManager(
                responseTemplates: new IResponseIdCollection[]
            {
                new AutomotiveSkillMainResponses(),
                new AutomotiveSkillSharedResponses(),
                new VehicleSettingsResponses()
            },
                locales: new string[] { "en-us", "de-de", "es-es", "fr-fr", "it-it", "zh-cn" });
            ImageAssetLocation = "https://localhost";
            this.Services.Properties.Add("ImageAssetLocation", ImageAssetLocation);

            builder.RegisterInstance(new BotStateSet(this.UserState, this.ConversationState));

            builder.RegisterInstance(new BotStateSet(UserState, ConversationState));

            Container = builder.Build();

            TelemetryClient = new NullBotTelemetryClient();

            // Mock HttpContext for image path resolution
            MockHttpContext = new DefaultHttpContext();
            MockHttpContext.Request.Scheme = "http";
            MockHttpContext.Request.Host   = new HostString("localhost", 3980);

            MockHttpContextAcessor = new HttpContextAccessor
            {
                HttpContext = MockHttpContext
            };
        }
Beispiel #5
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");
        }