private void CheckTypeRegistration <TService, TContext>(
            TService service,
            Func <ListenerValidator <TService, TContext>, IHostBuilder, IHost> buildAction)
            where TService : IServiceFabricService <TContext>
            where TContext : ServiceContext
        {
            ListenerValidator <TService, TContext> validator = new ListenerValidator <TService, TContext>();

            IHostBuilder hostBuilder = new HostBuilder()
                                       .UseDefaultServiceProvider(options =>
            {
                options.ValidateOnBuild = true;
                options.ValidateScopes  = true;
            });

            IHost host = buildAction(validator, hostBuilder);
            IListenerBuilder <TService> builder = host.Services.GetService <IListenerBuilder <TService> >();

            Assert.IsNotNull(builder);

            KestrelListenerBuilder <MockStartup, TService, TContext> kestrelBuilder
                = (KestrelListenerBuilder <MockStartup, TService, TContext>)builder;

            IWebHost webHost = validator.ValidateListenerBuilder(service.Context, kestrelBuilder);

            validator.ValidateOmexTypesRegistered(webHost);
            validator.ValidateBuildFunction(service, kestrelBuilder);
        }
示例#2
0
        private void CheckTypeRegistration <TService, TContext>(TService service)
            where TService : IServiceFabricService <TContext>
            where TContext : ServiceContext
        {
            ListenerValidator <TService, TContext> validator = new ListenerValidator <TService, TContext>();

            KestrelListenerBuilder <MockStartup, TService, TContext> builder =
                new KestrelListenerBuilder <MockStartup, TService, TContext>(
                    validator.ListenerName,
                    validator.IntegrationOptions,
                    validator.BuilderAction);

            validator.ValidateListenerBuilder(service.Context, builder);
            validator.ValidateBuildFunction(service, builder);
        }
示例#3
0
        private void CheckTypeRegistration <TService, TContext>(TService service)
            where TService : IServiceFabricService <TContext>
            where TContext : ServiceContext
        {
            ListenerValidator <TService, TContext> validator = new ListenerValidator <TService, TContext>();
            ServiceProvider serviceProvider = new ServiceCollection()
                                              .AddOmexServiceFabricDependencies <TContext>()
                                              .BuildServiceProvider();

            KestrelListenerBuilder <MockStartup, TService, TContext> builder =
                new KestrelListenerBuilder <MockStartup, TService, TContext>(
                    validator.ListenerName,
                    serviceProvider,
                    validator.IntegrationOptions,
                    validator.BuilderAction,
                    validator.KestrelOptionsAction);

            IWebHost host = validator.ValidateListenerBuilder(service.Context, builder);

            validator.ValidateBuildFunction(service, builder);
            validator.ValidateKestrelServerOptionsSet(host);
        }