Beispiel #1
0
        /// <inheritdoc />
        public Action <IApplicationBuilder> Configure(Action <IApplicationBuilder> next)
        {
            Ensure.IsNotNull(next, nameof(next));

            var context = new ModuleInitialisationContext(_serviceProvider);

            foreach (var module in _moduleProvider.Modules)
            {
                module.Initialise(context);
            }

            return(next);
        }
Beispiel #2
0
        public void Configure_ExecutesModuleInitialisation()
        {
            // Arrange
            ModuleInitialisationContext capturedContext = null;

            var serviceProvider = Mock.Of <IServiceProvider>();
            var filter          = new ModuleInitialiserStartupFilter(
                serviceProvider,
                CreateModuleProvider(
                    CreateModule(mic => capturedContext = mic)));

            Action <IApplicationBuilder> configure = _ => { };

            // Act
            filter.Configure(configure);

            // Assert
            Assert.NotNull(capturedContext);
            Assert.Same(serviceProvider, capturedContext.ApplicationServices);
        }
Beispiel #3
0
 /// <inheritdoc />
 public virtual void Initialise(ModuleInitialisationContext context)
 {
 }