internal static EventTelemetry ToTelemetry([NotNull] this BbTimedEvent @event)
        {
            try
            {
                var tEvent = new EventTelemetry
                {
                    Name      = @event.GetType().Name,
                    Timestamp = DateTimeOffset.Now,
                };

                tEvent.Metrics[nameof(BbTimedEvent.ProcessingTime)] = @event.ProcessingTime.TotalSeconds;

                tEvent.SetCorrelation(@event);
                @event.CopyPropertiesInto(tEvent.Properties);

                return(tEvent);
            }
            catch (Exception ex)
            {
#if DEBUG
                if (Debugger.IsAttached)
                {
                    throw;
                }
#endif
                BigBrother.PublishError(ex);
                return(null);
            }
        }
        public void Ensure_NullCorrelation_DoesntPopulate()
        {
            const string correlationVector = null;
            var          tEvent            = new EventTelemetry();
            var          bbEvent           = new BbTelemetryEvent
            {
                CorrelationVector = correlationVector
            };

            tEvent.SetCorrelation(bbEvent);

            tEvent.Context.Operation.CorrelationVector.Should().BeNull();
            tEvent.Context.Operation.Id.Should().BeNull();
        }
        public void Test_EventTelemetry_OperationIsPoPulated()
        {
            const string correlationVector = "SOMEIDHERE.1.3";
            var          tEvent            = new EventTelemetry();
            var          bbEvent           = new BbTelemetryEvent
            {
                CorrelationVector = correlationVector
            };

            tEvent.SetCorrelation(bbEvent);

            tEvent.Context.Operation.CorrelationVector.Should().Be(correlationVector);
            tEvent.Context.Operation.Id.Should().Be(correlationVector);
        }