public void WeaveMyApplication()
        {
            TraceLoggingConfiguration.TraceLoggingConfigurationBuilder config = TraceLoggingConfiguration.New
                                                                                .WithFilter(new PublicMethodsFilter())
                                                                                .WithAdapterAssembly(typeof(Serilog.Log).Assembly.GetName().FullName)
                                                                                .WithLogManager(typeof(Serilog.Adapters.LogManagerAdapter).FullName)
                                                                                .WithLogger(typeof(Serilog.Adapters.LoggerAdapter).FullName)
                                                                                .WithStaticLogger(typeof(Serilog.Log).FullName);

            AssemblyWeaver.Execute("..\\..\\..\\TestApplication.Serilog\\bin\\debug\\TestApplication.Serilog.exe", config);
        }
Beispiel #2
0
        protected void Rewrite(string assemblyPath, ITraceLoggingFilter filter)
        {
            //Set-up log adapter to our mock
            var assembly = Assembly.GetExecutingAssembly();

            var config = TraceLoggingConfiguration.New
                         .WithFilter(filter)
                         .WithAdapterAssembly(assembly.GetName().FullName)
                         .WithLogManager(typeof(MockLogManagerAdapter).FullName)
                         .WithLogger(typeof(IMockLogAdapter).FullName)
                         .WithStaticLogger(typeof(MockLog).FullName);

            AssemblyWeaver.Execute(assemblyPath, config);
        }
        public void The_xamlator_assembly_is_weaved_with_the_current_ip()
        {
            var task = new AssemblyWeaver();

            task.Path        = BuildConstants.XAMLATOR_ASSEMBLY;
            task.BuildEngine = Mock.Of <IBuildEngine>();
            task.Execute();

            var assembly = Assembly.LoadFrom(BuildConstants.XAMLATOR_ASSEMBLY);

            using (Stream stream = assembly.GetManifestResourceStream(BuildConstants.IDE_IP_RESOURCE_NAME))
                using (StreamReader reader = new StreamReader(stream))
                {
                    var ip = reader.ReadLine();
                    Assert.AreEqual(BuildNetworkUtils.DeviceIps().First(), ip);
                }
        }
Beispiel #4
0
        protected void Rewrite(string assemblyPath, ITraceLoggingFilter filter, bool traceConstructors = false)
        {
            //Set-up log adapter to our mock
            Assembly assembly = Assembly.GetExecutingAssembly();

            TraceLoggingConfiguration.TraceLoggingConfigurationBuilder config = TraceLoggingConfiguration.New
                                                                                .WithFilter(filter)
                                                                                .WithAdapterAssembly(assembly.GetName().FullName)
                                                                                .WithLogManager(typeof(MockLogManagerAdapter).FullName)
                                                                                .WithLogger(typeof(MockLogAdapter).FullName)
                                                                                .WithStaticLogger(typeof(MockLog).FullName);

            if (traceConstructors)
            {
                config.WithConstructorTraceOn();
            }

            AssemblyWeaver.Execute(assemblyPath, config);
        }