public void FactoryReturnsCloudFoundryCreatorForCloudFoundry() { Environment.SetEnvironmentVariable("VCAP_APPLICATION", TestHelpers.VCAP_APPLICATION); var serviceInfoCreator = ServiceInfoCreatorFactory.GetServiceInfoCreator(new ConfigurationBuilder().AddCloudFoundry().Build()); Assert.IsType <CloudFoundryServiceInfoCreator>(serviceInfoCreator); }
public void FactoryReturnsDefaultType() { Environment.SetEnvironmentVariable("VCAP_APPLICATION", string.Empty); Environment.SetEnvironmentVariable("VCAP_SERVICES", string.Empty); var serviceInfoCreator = ServiceInfoCreatorFactory.GetServiceInfoCreator(new ConfigurationBuilder().AddConnectionStrings().Build()); Assert.IsType <ServiceInfoCreator>(serviceInfoCreator); }
public void CustomCreatorIsRetrieved() { var config = new ConfigurationBuilder().Build(); var creator = ServiceInfoCreatorFactory.GetServiceInfoCreator(config); Assert.IsType <TestServiceInfoCreator>(creator); Assert.Single(creator.ServiceInfos); }
public void Factory_ReturnsSameInstance() { var config = new ConfigurationBuilder().Build(); var inst = ServiceInfoCreatorFactory.GetServiceInfoCreator(config); Assert.NotNull(inst); var inst2 = ServiceInfoCreatorFactory.GetServiceInfoCreator(config); Assert.Same(inst, inst2); }
public void CustomCreatorCanBePresentAndDisabled() { var config = new ConfigurationBuilder().Build(); Environment.SetEnvironmentVariable("TestServiceInfoCreator", "false"); var creator = ServiceInfoCreatorFactory.GetServiceInfoCreator(config); Assert.IsType <ServiceInfoCreator>(creator); Assert.Equal(13, creator.Factories.Count); Environment.SetEnvironmentVariable("TestServiceInfoCreator", null); }
public void FactoryThrowsOnNullConfig() { var exception = Assert.Throws <ArgumentNullException>(() => ServiceInfoCreatorFactory.GetServiceInfoCreator(null)); Assert.Equal("configuration", exception.ParamName); }