public Dependency_Tester() { //LocalIocManager.IocContainer.Register( // Component.For<IUserRepository, UserRepository>().ImplementedBy<UserRepository>().LifestyleSingleton() //); LocalIocManager.RegisterAssemblyByConvention(typeof(IRepository).Assembly); }
public void Should_Get_Different_Objects_For_Transients_Dependency_When_Registred_With_Registrar_Passing_By_Parameter() { //Arrange //Act LocalIocManager.RegisterAssemblyByConvention(typeof(TestTransientDependencyObject).Assembly, new BasicConventionalRegistrar()); var transientDependencyObject1 = LocalIocManager.Resolve <TestTransientDependencyObject>(); var transientDependencyObject2 = LocalIocManager.Resolve <TestTransientDependencyObject>(); //Assert transientDependencyObject1.ShouldNotBeNull(); transientDependencyObject2.ShouldNotBeNull(); transientDependencyObject1.ShouldNotBeSameAs(transientDependencyObject2); }
public void Should_Get_Same_Objects_For_Singleton_Dependency_When_Registred_By_Basic_Conventional_Registrar() { //Arrange LocalIocManager.AddConventionalRegistrar(new BasicConventionalRegistrar()); //Act LocalIocManager.RegisterAssemblyByConvention(typeof(TestSingletonDependencyObject).Assembly); var transientDependencyObject1 = LocalIocManager.Resolve <TestSingletonDependencyObject>(); var transientDependencyObject2 = LocalIocManager.Resolve <TestSingletonDependencyObject>(); //Assert transientDependencyObject1.ShouldNotBeNull(); transientDependencyObject2.ShouldNotBeNull(); transientDependencyObject1.ShouldBeSameAs(transientDependencyObject2); }