public void AllowZeroAttribute_makes_number_zero_valid()
        {
            var serviceCollection = new ServiceCollection();
            var configuration     = OptionsWithAttributes.GetConfiguration(optionWithAllowZero: 0);

            serviceCollection.RegisterOptionsByConvention <OptionsWithAttributes>(configuration);

            var result = serviceCollection.ValidateIOptionsValues();

            result.Should().Be(true);
        }
        public void option_with_AllowEmptyAttribute_is_invalid_when_filled_with_null()
        {
            var serviceCollection = new ServiceCollection();
            var configuration     = OptionsWithAttributes.GetConfiguration(optionWithAllowEmpty: null);

            serviceCollection.RegisterOptionsByConvention <OptionsWithAttributes>(configuration);

            var result = serviceCollection.ValidateIOptionsValues();

            result.Should().Be(false);
        }
        public void AllowEmptyStringAttribute_makes_empty_string_valid()
        {
            var serviceCollection = new ServiceCollection();
            var configuration     = OptionsWithAttributes.GetConfiguration(optionWithAllowEmpty: "");

            serviceCollection.RegisterOptionsByConvention <OptionsWithAttributes>(configuration);

            var result = serviceCollection.ValidateIOptionsValues();

            result.Should().Be(true);
        }
        public void combination_of_allow_attributes_makes_options_valid()
        {
            var serviceCollection = new ServiceCollection();
            var configuration     = OptionsWithAttributes.GetConfiguration(null, "", 0);

            serviceCollection.RegisterOptionsByConvention <OptionsWithAttributes>(configuration);

            var result = serviceCollection.ValidateIOptionsValues();

            result.Should().Be(true);
        }