public virtual void Initialize() { Services = new ServiceCollection(); Services.AddSingleton(new BotSettings()); Services.AddSingleton(new BotServices() { // Non US languages are empty as Dispatch/LUIS not required for localization tests. CognitiveModelSets = new Dictionary <string, CognitiveModelSet> { { "en-us", new CognitiveModelSet { DispatchService = DispatchTestUtil.CreateRecognizer(), LuisServices = new Dictionary <string, LuisRecognizer> { { "General", GeneralTestUtil.CreateRecognizer() } }, QnAConfiguration = new Dictionary <string, Microsoft.Bot.Builder.AI.QnA.QnAMakerEndpoint> { { "Chitchat", new QnAMakerEndpoint { KnowledgeBaseId = _knowledgeBaseId, EndpointKey = _endpointKey, Host = _hostname } } } } }, { "zh-cn", new CognitiveModelSet { } }, { "fr-fr", new CognitiveModelSet { } }, { "es-es", new CognitiveModelSet { } }, { "de-de", new CognitiveModelSet { } }, { "it-it", new CognitiveModelSet { } } } }); Services.AddSingleton <IBotTelemetryClient, NullBotTelemetryClient>(); Services.AddSingleton(new MicrosoftAppCredentials("appId", "password")); Services.AddSingleton(new UserState(new MemoryStorage())); Services.AddSingleton(new ConversationState(new MemoryStorage())); // For localization testing CultureInfo.CurrentUICulture = new CultureInfo("en-us"); var localizedTemplates = new Dictionary <string, string>(); var templateFile = "AllResponses"; var supportedLocales = new List <string>() { "en-us", "de-de", "es-es", "fr-fr", "it-it", "zh-cn" }; foreach (var locale in supportedLocales) { // LG template for en-us does not include locale in file extension. var localeTemplateFile = locale.Equals("en-us") ? Path.Combine(".", "Responses", $"{templateFile}.lg") : Path.Combine(".", "Responses", $"{templateFile}.{locale}.lg"); localizedTemplates.Add(locale, localeTemplateFile); } TestLocaleTemplateManager = new LocaleTemplateManager(localizedTemplates, "en-us"); Services.AddSingleton(TestLocaleTemplateManager); Services.AddTransient <MockMainDialog>(); Services.AddTransient <OnboardingDialog>(); Services.AddTransient <SwitchSkillDialog>(); Services.AddTransient <List <SkillDialog> >(); Services.AddSingleton <TestAdapter, DefaultTestAdapter>(); Services.AddTransient <IBot, DefaultActivityHandler <MockMainDialog> >(); TestUserProfileState = new UserProfileState(); TestUserProfileState.Name = "Bot"; }