public static IServiceCollection AddMyControllers(this IServiceCollection services) { services.AddControllers() .SetCompatibilityVersion(CompatibilityVersion.Version_3_0) .AddNewtonsoftJson(MvcNewtonsoftJsonOptionsFactory.Create()); return(services); }
public void Create_ReturnsMvcNewtonsoftJsonOptions(MvcNewtonsoftJsonOptions options) { var action = MvcNewtonsoftJsonOptionsFactory.Create(); action.Invoke(options); // Asserts options.SerializerSettings.Converters.OfType <StringEnumConverter>().Should().NotBeEmpty(); options.SerializerSettings.NullValueHandling.Should().Be(NullValueHandling.Ignore); }