public void TestGetSingletonWithManualInstantiation() { MyServiceWithNoDependencies myService = new MyServiceWithNoDependencies(); IServiceProvider serviceProvider = new ServiceCollection() .AddSingleton <IMyService>(myService) .BuildServiceProvider(); Assert.IsTrue(serviceProvider.GetService <IMyService>().Equals(myService)); }
public MyServiceWithMultipleConstructorsAndOptionalDependencies(MyServiceWithNoDependencies service1 = null, MyServiceWithNoDependencies service2 = null) { InvokedConstructorId = 2; }
public MyServiceWithMultipleConstructorsWithActivatorUtilitiesConstructor(MyServiceWithNoDependencies service) { }
public MyServiceWithMultipleConstructors(MyServiceWithNoDependencies service) { }
public MyServiceWithOptionalDependencies(MyServiceWithNoDependencies service = null) { }
public MyServiceWithDependencies(MyServiceWithNoDependencies service) { }