public async Task Options_Bind_IfTypeIsNull_ShouldResultInTypeIsNull()
        {
            var configuration = await this.CreateConfigurationAsync("appsettings.Valid").ConfigureAwait(false);

            var options = new TypeOptionsMock();

            Assert.IsNull(options.Type);
            configuration.GetSection("TypeOptionsMock1").Bind(options);
            Assert.IsNull(options.Type);
        }
        public async Task Options_Bind_Test()
        {
            var configuration = await this.CreateConfigurationAsync("appsettings.Valid").ConfigureAwait(false);

            var options = new TypeOptionsMock();

            configuration.GetSection("TypeOptionsMock3").Bind(options);
            Assert.AreEqual(typeof(string), options.Type);

            options = new TypeOptionsMock();
            configuration.GetSection("TypeOptionsMock4").Bind(options);
            Assert.AreEqual(this.GetType(), options.Type);
        }
        public async Task Options_Bind_IfTypeIsInvalid_ShouldThrowAnInvalidOperationException()
        {
            var configuration = await this.CreateConfigurationAsync("appsettings.Invalid").ConfigureAwait(false);

            var options = new TypeOptionsMock();

            try
            {
                configuration.GetSection("TypeOptionsMock1").Bind(options);
            }
            catch (InvalidOperationException invalidOperationException)
            {
                if (string.Equals(invalidOperationException.Message, "Failed to convert configuration value at 'TypeOptionsMock1:Type' to type 'System.Type'.", StringComparison.Ordinal))
                {
                    throw;
                }
            }
        }
        public async Task Options_Bind_WithoutTypeTypeConverter_Test()
        {
            TypeDescriptor.RemoveProvider(_typeDescriptionProvider, typeof(Type));
            TypeDescriptor.Refresh(typeof(Type));

            var typeConverter = TypeDescriptor.GetConverter(typeof(Type));

            Assert.AreEqual(typeof(TypeConverter), typeConverter.GetType());

            var configuration = await this.CreateConfigurationAsync("appsettings.Invalid").ConfigureAwait(false);

            var options = new TypeOptionsMock();

            configuration.GetSection("TypeOptionsMock1").Bind(options);
            Assert.IsNull(options.Type);

            _typeDescriptionProvider = TypeDescriptor.AddAttributes(typeof(Type), new TypeConverterAttribute(typeof(TypeTypeConverter)));
        }