Exemple #1
0
        private static IContainer BuildContainer()
        {
            var mockConfigurationProvider = new Mock <IAppConfigurationProvider>();
            var nvCol = new NameValueCollection {
                { ServerConfiguration.WebApplication.AppSettingKeys.TaskScheduleTrigger, "1" }
            };

            mockConfigurationProvider.SetupGet(cp => cp.Settings).Returns(nvCol);
            var autofac = new AutoFac(mockConfigurationProvider.Object)
            {
                SkipRavenDbInitialization = true
            };

            autofac.Configure();
            //capture DocumentStore for manual disposal during test tear down.  Otherwise, subsequent tests will fail with concurrency exceptions
            _documentStore = autofac.Container.Resolve <IDocumentStore>();
            return(autofac.Container);
        }