public MyJobLeadsMembershipProvider(IServiceFactory factory) { // IF no factory was provided, we need to get one from the bootstrapper if (factory == null) { _serviceFactory = new WindsorServiceFactory(Bootstrapper.WindsorContainer); } else { _serviceFactory = factory; } }
public void Service_Provider_Retrieves_Requested_Service_Class() { // Setup IWindsorContainer container = new WindsorContainer(); container.Install(new TestInstaller()); WindsorServiceFactory provider = new WindsorServiceFactory(container); // Act MockServiceTestClass result = provider.GetService <MockServiceTestClass>(); // Verify Assert.IsNotNull(result, "Service provider returned a null service object"); }
public void MJLServiceNotFoundException_Thrown_When_Provider_Doesnt_Have_Service_Instance() { // Setup IServiceFactory provider = new WindsorServiceFactory(new WindsorContainer()); // Act try { provider.GetService <WindsorServiceFactory>(); Assert.Fail("No exception occurred but one was expected"); } // Verify catch (MJLServiceNotFoundException ex) { Assert.AreEqual(typeof(WindsorServiceFactory), ex.RequestedServiceType, "MJLServiceNotFoundException's requested service type was incorrect"); } }