Пример #1
0
            public void Configure(IServiceCollection?services, ConfigureTestStartup2 self)
            {
                Assert.Null(services);

                Assert.Equal(this, self);

                Invoked = true;
            }
Пример #2
0
        public void ConfigureTest()
        {
            var startup     = new ConfigureTestStartup2();
            var hostBuilder = new HostBuilder().ConfigureServices(s => s.AddSingleton(startup));

            var services = hostBuilder.Build().Services;

            StartupLoader.Configure(services, new EmptyStartup());

            Assert.Throws <InvalidOperationException>(() => StartupLoader.Configure(services, new ConfigureTestStartup0()));

            Assert.Throws <InvalidOperationException>(() => StartupLoader.Configure(services, new ConfigureTestStartup1()));

            StartupLoader.Configure(services, startup);

            Assert.True(startup.Invoked);
        }
        public void Configure(ConfigureTestStartup2 self)
        {
            Assert.Equal(this, self);

            Invoked = true;
        }