public void TestAllPropertiesWhenActivityRunning(ActivityTraceProperty property, string format, string output)
        {
            bool orgThrowExceptions = LogManager.ThrowExceptions;

            try
            {
                DateTime startedTime = new DateTime(1, DateTimeKind.Utc);

                LogManager.ThrowExceptions          = true;
                System.Diagnostics.Activity.Current = new System.Diagnostics.Activity("MyOperation").Start();
                System.Diagnostics.Activity.Current.SetStartTime(startedTime);

                var logEvent = LogEventInfo.CreateNullEvent();

                ActivityTraceLayoutRenderer layoutRenderer = new ActivityTraceLayoutRenderer();
                layoutRenderer.Property = property;
                layoutRenderer.Format   = format;
                var result = layoutRenderer.Render(logEvent);
                if (output != null)
                {
                    Assert.Equal(output, result);
                }
            }
            finally
            {
                LogManager.ThrowExceptions = orgThrowExceptions;
            }
        }
        public void TestAllPropertiesWhenActivityEmpty(ActivityTraceProperty property, bool empty)
        {
            bool orgThrowExceptions = LogManager.ThrowExceptions;

            try
            {
                LogManager.ThrowExceptions = true;

                using (var newActivity = new System.Diagnostics.Activity(null).Start())
                {
                    System.Diagnostics.Activity.Current.SetStartTime(new DateTime(0, DateTimeKind.Utc));

                    var logEvent = LogEventInfo.CreateNullEvent();

                    ActivityTraceLayoutRenderer layoutRenderer = new ActivityTraceLayoutRenderer();
                    layoutRenderer.Property = property;
                    var result = layoutRenderer.Render(logEvent);
                    Assert.True(string.IsNullOrEmpty(result) == empty);
                }
            }
            finally
            {
                LogManager.ThrowExceptions = orgThrowExceptions;
            }
        }