public ILogFilter Assemble(IBuilderContext context, LogFilterData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { LogEnabledFilterData castedObjectConfiguration = (LogEnabledFilterData)objectConfiguration; ILogFilter createdObject = new LogEnabledFilter( castedObjectConfiguration.Name, castedObjectConfiguration.Enabled); return(createdObject); }
public FilterLogEnabledBuilder(ILoggingConfigurationOptions context, string logEnabledFilterName) :base(context) { logEnabledFilterData = new LogEnabledFilterData() { Name = logEnabledFilterName }; base.LoggingSettings.LogFilters.Add(logEnabledFilterData); }
public void CanCreatePoliciesForEnabledFilter() { LogEnabledFilterData data = new LogEnabledFilterData("provider name", true); loggingSettings.LogFilters.Add(data); using (var container = CreateContainer()) { LogEnabledFilter createdObject = (LogEnabledFilter)container.Resolve<ILogFilter>("provider name"); Assert.IsNotNull(createdObject); Assert.AreEqual("provider name", createdObject.Name); Assert.AreEqual(true, createdObject.Enabled); } }
public void CanCreateLogEnabledFilterFromConfiguration() { LogEnabledFilterData filterData = new LogEnabledFilterData(true); MockLogObjectsHelper helper = new MockLogObjectsHelper(); helper.loggingSettings.LogFilters.Add(filterData); ILogFilter filter = GetFilter(filterData.Name, helper.configurationSource); Assert.IsNotNull(filter); Assert.AreEqual(filter.GetType(), typeof(LogEnabledFilter)); Assert.AreEqual(true, ((LogEnabledFilter)filter).Enabled); }
public void CanCreateLogEnabledFilterFromConfiguration() { LogEnabledFilterData filterData = new LogEnabledFilterData(true); MockLogObjectsHelper helper = new MockLogObjectsHelper(); ILogFilter filter = LogFilterCustomFactory.Instance.Create(context, filterData, helper.configurationSource, reflectionCache); ; Assert.IsNotNull(filter); Assert.AreEqual(filter.GetType(), typeof(LogEnabledFilter)); Assert.AreEqual(true, ((LogEnabledFilter)filter).Enabled); }