public void Singleton_Singleton_Singleton_RootScope() { // Arrange ContainerBuilder containerBuilder = new ContainerBuilder(); containerBuilder.RegisterType <FirstLayer>().As <IFirstLayer>().SingleInstance(); containerBuilder.RegisterType <SecondLayer>().As <ISecondLayer>().SingleInstance(); containerBuilder.RegisterType <ThirdLayer>().As <IThirdLayer>().SingleInstance(); IContainer container = containerBuilder.Build(); // Act IThirdLayer thirdLayer1 = container.Resolve <IThirdLayer>(); IThirdLayer thirdLayer2 = container.Resolve <IThirdLayer>(); // Assert thirdLayer1.AllInstanceNames.Should().Equal(thirdLayer2.AllInstanceNames); }
public FourthLayer(IThirdLayer thirdLayer) { ThirdLayer = thirdLayer; }
public FourthLayerB(IThirdLayer thirdLayer, IThirdLayerA thirdLayerA, IThirdLayerB thirdLayerB) { ThirdLayer = thirdLayer; ThirdLayerA = thirdLayerA; ThirdLayerB = thirdLayerB; }
//constructor injection for the win! public SomeBusinessLogicClass(IThirdLayer repository) { _repository = repository; }
public FourthLayerA(IThirdLayer thirdLayer, IThirdLayerA thirdLayerA) { ThirdLayer = thirdLayer; ThirdLayerA = thirdLayerA; }