예제 #1
0
        /// <summary>
        /// Please set the following connection strings in app.config for this WebJob to run: AzureWebJobsDashboard and AzureWebJobsStorage
        /// </summary>
        public static void Main()
        {
            var unityContainer = new SearchUnityContainer(new AppSettings());
            var config         = new JobHostConfiguration
            {
                JobActivator = new UnityWebJobActivator(unityContainer)
            };
            var services     = unityContainer.Resolve <IList <IDocumentService> >();
            var indexService = unityContainer.Resolve <IIndexService>();
            var host         = new JobHost();

            host.Call(typeof(Functions).GetMethod("ManualTrigger"), new { documentServices = services, indexService = indexService, settings = new AppSettings() });
        }
        public void TestInit()
        {
            appSettings       = new NameValueCollection();
            connectionStrings = new ConnectionStringSettingsCollection();
            settings          = new AppSettings(appSettings, connectionStrings);
            appSettings.Add(AppSettings.SEARCH_API_KEY, "api key");
            appSettings.Add(AppSettings.SEARCH_INDEX_NAME_KEY, "index name");
            appSettings.Add(AppSettings.SEARCH_SERVICE_NAME_KEY, "service name");

            connectionStrings.Add(new ConnectionStringSettings(AppSettings.ECA_CONTEXT_KEY, "eca"));
            connectionStrings.Add(new ConnectionStringSettings(AppSettings.AZURE_WEB_JOBS_DASHBOARD_KEY, "dashboard"));
            connectionStrings.Add(new ConnectionStringSettings(AppSettings.AZURE_WEB_JOBS_STORAGE_KEY, "storage"));

            container = new SearchUnityContainer(settings);
        }