public void Logs_nothing_when_using_valid_custom_config()
        {
            var loggerFactory = TestLoggerFactory.Create();
            var logger        = loggerFactory.CreateLogger <ResponseSerializationOptions>();

            var options = new ResponseSerializationOptions(new ServiceCollection())
            {
                DefaultResponseCasing = ResponseCasing.PascalCase
            };

            options.ValidateConfiguration(logger);

            Assert.Empty(loggerFactory.Sink.LogEntries.ToList());
        }
        public void Logs_nothing_when_using_valid_config_with_formatters()
        {
            var loggerFactory = TestLoggerFactory.Create();
            var logger        = loggerFactory.CreateLogger <ResponseSerializationOptions>();

            var options = new ResponseSerializationOptions(new ServiceCollection())
            {
                UseOutputFormatters = true
            };

            options.ValidateConfiguration(logger);

            Assert.Empty(loggerFactory.Sink.LogEntries.ToList());
        }
        public void Logs_warning_when_using_invalid_config_with_custom_settings_and_formatters()
        {
            var expectedLogMessage = $"ResponseSerialization {nameof(ResponseSerializationOptions.UseOutputFormatters)} is set to true, " +
                                     $"and it's also configured to use either a custom response casing or custom json serializer settings. " +
                                     $"When using output formatters, custom settings are ignored.";

            var loggerFactory = TestLoggerFactory.Create();
            var logger        = loggerFactory.CreateLogger <ResponseSerializationOptions>();

            var options = new ResponseSerializationOptions(new ServiceCollection())
            {
                UseOutputFormatters = true
            };

            options.UseCustomJsonSerializerSettings(request => new JsonSerializerSettings());
            options.ValidateConfiguration(logger);

            var log = Assert.Single(loggerFactory.Sink.LogEntries);

            Assert.Equal(expectedLogMessage, log.Message);
            Assert.Equal(LogLevel.Warning, log.LogLevel);
        }