public SerilogTests() { AppDomainAssemblyFinder.Attach(); beforeAssemblyPath = Path.GetFullPath(@"..\..\..\SerilogAssemblyToProcess\bin\Debug\SerilogAssemblyToProcess.dll"); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); }
public CustomTests() { AppDomainAssemblyFinder.Attach(); beforeAssemblyPath = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\CustomAssemblyToProcess\bin\Debug\CustomAssemblyToProcess.dll")); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); }
public GenericExternalTests() { AppDomainAssemblyFinder.Attach(); var beforeAssemblyPath = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\WithGenericExternal\bin\Debug\WithGenericExternal.dll")); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); }
public NonGenericExternalTests() { AppDomainAssemblyFinder.Attach(); var beforeAssemblyPath = Path.GetFullPath(@"..\..\..\WithNonGenericExternal\bin\Debug\WithNonGenericExternal.dll"); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); }
public NServiceBusTests() { AppDomainAssemblyFinder.Attach(); beforeAssemblyPath = Path.GetFullPath(@"..\..\..\NServiceBusAssemblyToProcess\bin\Debug\NServiceBusAssemblyToProcess.dll"); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); LogManager.UseFactory(new LogCapture(this)); }
public CommonLoggingTests() { AppDomainAssemblyFinder.Attach(); beforeAssemblyPath = Path.GetFullPath(@"..\..\..\CommonLoggingAssemblyToProcess\bin\Debug\CommonLoggingAssemblyToProcess.dll"); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); actionAdapter = new ActionAdapter(); LogManager.Adapter = actionAdapter; }
public SplatTests() { AppDomainAssemblyFinder.Attach(); beforeAssemblyPath = Path.GetFullPath(@"..\..\..\SplatAssemblyToProcess\bin\Debug\SplatAssemblyToProcess.dll"); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); Locator.CurrentMutable.Register(() => new FuncLogManager(GetLogger), typeof(ILogManager)); }
public LibLogTests() { AppDomainAssemblyFinder.Attach(); beforeAssemblyPath = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\LibLogAssemblyToProcess\bin\Debug\LibLogAssemblyToProcess.dll")); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); logProvider = new LogCapture(); LogProvider.SetCurrentLogProvider(logProvider); }
public CatelTests() { AppDomainAssemblyFinder.Attach(); beforeAssemblyPath = Path.GetFullPath(@"..\..\..\CatelAssemblyToProcess\bin\Debug\CatelAssemblyToProcess.dll"); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); LogManager.AddListener(new LogListener { Action = LogMessage }); }
protected CatelTests(string assemblyName) { AppDomainAssemblyFinder.Attach(); beforeAssemblyPath = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, $@"..\..\..\{assemblyName}\bin\Debug\CatelAssemblyToProcess.dll")); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); LogManager.AddListener(new LogListener { Action = LogMessage }); }
private void WeaveAssembly(string target) { lock (weaverLock) { if (assemblies.ContainsKey(target) == false) { AppDomainAssemblyFinder.Attach(); var assemblyPathUri = new Uri(new Uri(typeof(TestAssemblies).GetTypeInfo().Assembly.CodeBase), $"../../../../{assemblyToProcessName}/bin/Debug/{target}/{assemblyToProcessName}.dll"); var beforeAssemblyPath = Path.GetFullPath(assemblyPathUri.LocalPath); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif var afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assemblies[target] = Tuple.Create(Assembly.LoadFile(afterAssemblyPath), beforeAssemblyPath, afterAssemblyPath); } } }
public CommonLoggingTests() { #if (PORTABLE) var path = Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\CommonLoggingAssemblyToProcessPortable\bin\Debug\CommonLoggingAssemblyToProcessPortable.dll"); #else var path = Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\CommonLoggingAssemblyToProcess\bin\Debug\CommonLoggingAssemblyToProcess.dll"); #endif AppDomainAssemblyFinder.Attach(); beforeAssemblyPath = Path.GetFullPath(path); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); actionAdapter = new ActionAdapter(); LogManager.Adapter = actionAdapter; }
public Log4NetTests() { AppDomainAssemblyFinder.Attach(); beforeAssemblyPath = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\Log4NetAssemblyToProcess\bin\Debug\Log4NetAssemblyToProcess.dll")); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); var hierarchy = (Hierarchy)LogManager.GetRepository(); hierarchy.Root.RemoveAllAppenders(); var target = new ActionAppender { Action = LogEvent }; BasicConfigurator.Configure(target); }
private Assembly WeaveAssembly(string target) { lock (weaverLock) { if (assemblies.ContainsKey(target) == false) { AppDomainAssemblyFinder.Attach(); var assemblyPathUri = new Uri(new Uri(typeof(CustomTests).GetTypeInfo().Assembly.CodeBase), $"../../../../CustomAssemblyToProcess/bin/Debug/{target}/CustomAssemblyToProcess.dll"); beforeAssemblyPath = Path.GetFullPath(assemblyPathUri.LocalPath); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath, target); assemblies[target] = Assembly.LoadFile(afterAssemblyPath); } return(assemblies[target]); } }
public NLogTests() { AppDomainAssemblyFinder.Attach(); beforeAssemblyPath = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\NLogAssemblyToProcess\bin\Debug\NLogAssemblyToProcess.dll")); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); var config = new LoggingConfiguration(); var target = new ActionTarget { Action = LogEvent }; config.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, target)); config.AddTarget("debugger", target); LogManager.Configuration = config; }
public MetroLogTests() { AppDomainAssemblyFinder.Attach(); var configuration = LogManagerFactory.DefaultConfiguration; configuration.IsEnabled = true; beforeAssemblyPath = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\MetroLogAssemblyToProcess\bin\Debug\MetroLogAssemblyToProcess.dll")); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); var target = new ActionTarget { Action = LogEvent }; configuration.AddTarget(LogLevel.Trace, target); configuration.AddTarget(LogLevel.Debug, target); configuration.AddTarget(LogLevel.Warn, target); configuration.AddTarget(LogLevel.Info, target); configuration.AddTarget(LogLevel.Error, target); configuration.AddTarget(LogLevel.Fatal, target); }
public static void Initialize() { AppDomainAssemblyFinder.Attach(); }