public void Init() { ComponentRegistration.Reset(); ComponentRegistration.RegisterComponent <ICollector>(ConfigurationTests.TYPE_COLLECTOR); ComponentRegistration.RegisterComponent <IStack>(ConfigurationTests.TYPE_STACK); ComponentRegistration.RegisterComponent <IConverter>(ConfigurationTests.TYPE_CONVERTER); ComponentRegistration.RegisterComponent <IReader>(ConfigurationTests.TYPE_READER); ComponentRegistration.RegisterComponent <ITransformer>(ConfigurationTests.TYPE_TRANSFORMER); ComponentRegistration.RegisterComponent <ITransformedDataHandler>(ConfigurationTests.TYPE_TRANSFORMATION_HANDLER); ComponentRegistration.RegisterComponent <IPublisher>(ConfigurationTests.TYPE_PUBLISHER); ComponentRegistration.RegisterComponent <IMapper>(ConfigurationTests.TYPE_MAPPER); ComponentRegistration.RegisterComponent <IEntity>(ConfigurationTests.TYPE_DATA); ComponentRegistration.RegisterTypesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = "Collector.SDK", Type = "LoggerFacade" }); ComponentRegistration.RegisterModulesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = "Autofac.Extras.NLog", RegisterAll = true }); ComponentRegistration.Build(); }
public void TransformerRegistration_Success() { var transformers = new List <TransformerConfiguration>(); transformers.Add(CreateTransformerConfig("1", CreateMapperConfig("2", "1"), "3")); ComponentRegistration.Reset(); // the collector needs to be resgistered since it is injected ComponentRegistration.RegisterComponent <ICollector>(ConfigurationTests.TYPE_COLLECTOR); ComponentRegistration.RegisterComponents(transformers); ComponentRegistration.RegisterTypesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = "Collector.SDK", Type = "LoggerFacade" }); ComponentRegistration.RegisterModulesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = "Autofac.Extras.NLog", RegisterAll = true }); ComponentRegistration.Build(); var reader = ComponentRegistration.CreateInstance <ITransformer>(ConfigurationTests.TYPE_TRANSFORMER); reader.Should().NotBeNull(); }
public void SingletonRegistration_Fails_Without_Singleton_Flag() { var readers = new List <ReaderConfiguration>(); readers.Add(CreateReaderWithSingletonDependencyConfig("1", "2")); ComponentRegistration.Reset(); // the collector needs to be registered since it is injected ComponentRegistration.RegisterComponent <ICollector>(ConfigurationTests.TYPE_COLLECTOR); ComponentRegistration.RegisterComponents(readers); ComponentRegistration.RegisterTypesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = "Collector.SDK", Type = "LoggerFacade" }); ComponentRegistration.RegisterTypesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = typeof(MockDisposableSingleton).Assembly.GetName().Name, Type = nameof(MockDisposableSingleton), Singleton = false }); ComponentRegistration.RegisterModulesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = "Autofac.Extras.NLog", RegisterAll = true }); ComponentRegistration.Build(); IReader reader = null; Assert.ThrowsException <DependencyResolutionException>(() => reader = ComponentRegistration.CreateInstance <IReader>(ConfigurationTests.TYPE_READER_WITH_SINGLETON_DEPENDENCY)); reader.Should().BeNull(); }
public void Init() { ComponentRegistration.Reset(); ComponentRegistration.RegisterComponent <IEntity>(TYPE_MOCKUSER); ComponentRegistration.RegisterComponent <IConverter>(TYPE_DATE_TIME_COMBINE_CONVERTER); ComponentRegistration.RegisterComponent <IConverter>(TYPE_DATE_TIME_UTC_CONVERTER); ComponentRegistration.RegisterComponent <IConverter>(TYPE_UPPER_CASE_CONVERTER); ComponentRegistration.RegisterTypesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = ConfigurationTests.COLLECTOR_SDK_ASSEMBLY, Type = "LoggerFacade" }); ComponentRegistration.RegisterModulesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = ConfigurationTests.NLOG_EXTRAS_ASSEMBLY, RegisterAll = true }); ComponentRegistration.Build(); }
public void Init() { ComponentRegistration.Reset(); ComponentRegistration.RegisterComponent <IEntity>(TYPE_MOCKUSER); ComponentRegistration.RegisterComponent <IConverter>(TYPE_DATE_TIME_COMBINE_CONVERTER); ComponentRegistration.RegisterComponent <IConverter>(TYPE_DATE_TIME_UTC_CONVERTER); ComponentRegistration.RegisterComponent <IConverter>(TYPE_UPPER_CASE_CONVERTER); ComponentRegistration.RegisterTypesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = "Collector.SDK", Type = "LoggerFacade" }); ComponentRegistration.RegisterModulesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = "Autofac.Extras.NLog", RegisterAll = true }); ComponentRegistration.Build(); }
public void CollectorRegistration_Success() { ComponentRegistration.Reset(); ComponentRegistration.RegisterComponents(CreateCollectorConfig("1")); ComponentRegistration.RegisterTypesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = COLLECTOR_SDK_ASSEMBLY, Type = "LoggerFacade" }); ComponentRegistration.RegisterModulesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = NLOG_EXTRAS_ASSEMBLY, RegisterAll = true }); ComponentRegistration.Build(); var collector = ComponentRegistration.CreateInstance <ICollector>(ConfigurationTests.TYPE_COLLECTOR); collector.Should().NotBeNull(); }
public void MapperRegistration_Success() { ComponentRegistration.Reset(); ComponentRegistration.RegisterComponent(CreateMapperConfig("1", "2")); ComponentRegistration.RegisterTypesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = "Collector.SDK", Type = "LoggerFacade" }); ComponentRegistration.RegisterModulesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = "Autofac.Extras.NLog", RegisterAll = true }); ComponentRegistration.Build(); var mapper = ComponentRegistration.CreateInstance <IMapper>(ConfigurationTests.TYPE_MAPPER); mapper.Should().NotBeNull(); }
public void ComponentRegistration_Build_Success() { ComponentRegistration.Reset(); ComponentRegistration.RegisterComponent <ICollector>(ConfigurationTests.TYPE_COLLECTOR); ComponentRegistration.RegisterTypesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = "Collector.SDK", Type = "LoggerFacade" }); ComponentRegistration.RegisterModulesFromAssembly(new ThirdPartyAutofacConfiguration() { AssemblyName = "Autofac.Extras.NLog", RegisterAll = true }); ComponentRegistration.Build(); var collector = ComponentRegistration.CreateInstance <ICollector>(ConfigurationTests.TYPE_COLLECTOR); collector.Should().NotBeNull(); }