Пример #1
0
        public void TestGetSingletonWithManualInstantiation()
        {
            MyServiceWithNoDependencies myService = new MyServiceWithNoDependencies();

            IServiceProvider serviceProvider = new ServiceCollection()
                                               .AddSingleton <IMyService>(myService)
                                               .BuildServiceProvider();

            Assert.IsTrue(serviceProvider.GetService <IMyService>().Equals(myService));
        }
Пример #2
0
 public MyServiceWithMultipleConstructorsAndOptionalDependencies(MyServiceWithNoDependencies service1 = null, MyServiceWithNoDependencies service2 = null)
 {
     InvokedConstructorId = 2;
 }
Пример #3
0
 public MyServiceWithMultipleConstructorsWithActivatorUtilitiesConstructor(MyServiceWithNoDependencies service)
 {
 }
Пример #4
0
 public MyServiceWithMultipleConstructors(MyServiceWithNoDependencies service)
 {
 }
Пример #5
0
 public MyServiceWithOptionalDependencies(MyServiceWithNoDependencies service = null)
 {
 }
Пример #6
0
 public MyServiceWithDependencies(MyServiceWithNoDependencies service)
 {
 }