Exemplo n.º 1
0
        public void ConfigureOptionsRegistersClassAsIValidatableIntoDiContainer()
        {
            IConfiguration cfg      = new ConfigurationBuilder().Build();
            var            services = new ServiceCollection();

            services.ConfigureOptions <ValidatableTestSettings>(cfg);
            ServiceProvider provider = services.BuildServiceProvider();

            IValidatable settings = provider.GetRequiredService <IValidatable>();

            settings.Should().NotBeNull();
            settings.Should().BeOfType <ValidatableTestSettings>();
        }