public void AddJsonTypeOfType_registersSerializers() { var services = new ServiceCollection(); var builder = new SerializerBuilder(services); builder.AddJsonType <object>(); services.Should().BeEquivalentTo(new[] { new { ServiceType = typeof(IJsonSerializer), ImplementationType = new { Name = "DefaultJsonSerializer" } }, new { ServiceType = typeof(ISerializer <object>), ImplementationType = new { Name = "TypedJsonSerializer`1" } } }); }
/// <summary> /// Configures JSON serialization of <typeparamref name="TValue"/> type. /// </summary> /// <typeparam name="TValue">Serializing value type.</typeparam> public static SerializerBuilder AddJsonType <TValue>(this SerializerBuilder builder) => builder .AddJsonType(typeof(TValue));