Exemplo n.º 1
0
        public void Configure_ValidatesArguments()
        {
            // Arrange
            var filter = new ModuleInitialiserStartupFilter(
                Mock.Of <IServiceProvider>(),
                Mock.Of <IModuleProvider>());

            // Act

            // Assert
            Assert.Throws <ArgumentNullException>(() => filter.Configure(null /* next */));
        }
Exemplo n.º 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);
        }