I\'m using ASP.NET Core and I\'m attempting to create a resolvable class which has an optional parameter:
public class Foo
{
public Foo() : this(null)
You need to register the IValidator
first:
var services = new Microsoft.Extensions.DependencyInjection.ServiceCollection();
services.AddTransient, RealValidator>();
services.AddTransient();
var serviceProvider = services.BuildServiceProvider();
var validator = serviceProvider.GetService>();
var foo = serviceProvider.GetService();
Assert.NotNull(validator);
Assert.NotNull(foo);