示例#1
0
        public static void Initiate()
        {
            //if (initiated) return;
            //initiated = true;
            var dependencyResolver = DependencyResolver.Current as IDisposable;

            if (dependencyResolver != null)
            {
                dependencyResolver.Dispose();
            }
            var container = MvcApplication.BuildContainer();

            DependencyResolver.SetResolver(new CustomResolver(container));
        }
示例#2
0
            public async Task Init()
            {
                var tableClient = GetNewLoggingTableClient();
                var tablePrefix = "logtesZZ" + Guid.NewGuid().ToString("n");

                ConfigurationManager.AppSettings[FunctionLogTableAppSettingName] = tablePrefix; // tell dashboard to use it
                _provider = LogFactory.NewLogTableProvider(tableClient, tablePrefix);
                await WriteTestLoggingDataAsync(_provider);

                var config = new HttpConfiguration();

                var container = MvcApplication.BuildContainer(config);

                WebApiConfig.Register(config);

                var server = new HttpServer(config);
                var client = new HttpClient(server);

                this.Client   = client;
                this.Endpoint = "http://localhost:8080"; // ignored
            }
示例#3
0
        [InlineData(FunctionLogTableAppSettingName, null)]              // use classic SDK logging
        public void RegistrationTest(string appsetting, string value)
        {
            var oldSetting = ConfigurationManager.AppSettings[appsetting];

            try
            {
                ConfigurationManager.AppSettings[appsetting] = value;

                var container = MvcApplication.BuildContainer(new HttpConfiguration());

                // Verify we can create all the API & MVC controller classes.
                // This is really testing that all dependencies are properly registered
                container.Resolve <ApiControllers.DiagnosticsController>();
                container.Resolve <ApiControllers.FunctionsController>();
                container.Resolve <ApiControllers.LogController>();

                container.Resolve <Controllers.FunctionController>();
                container.Resolve <Controllers.MainController>();
            }
            finally
            {
                ConfigurationManager.AppSettings[appsetting] = oldSetting;
            }
        }