Пример #1
0
        public void TrackEvent(EventTelemetry eventTelemetry)
        {
            bool isDebug = IsDebugRun();

            if (!isDebug)
            {
                TelemetryService.TrackEvent(eventTelemetry, isDebug);
            }
        }
Пример #2
0
        // Menu item event handlers.
        public void miEnabled_Click(object sender, EventArgs e)
        {
            // Invert selection when this menu item is clicked.
            miEnabled.Checked = !miEnabled.Checked;
            // Match boolean variable on whether extension is enabled or not.
            bExtensionEnabled = miEnabled.Checked;
            // Set the application preference for this option.
            FiddlerApplication.Prefs.SetBoolPref("extensions.EXOFiddlerExtension.enabled", bExtensionEnabled);

            TelemetryService.TrackEvent($"ExtensionIsEnabled_{miEnabled.Checked}");
        }
Пример #3
0
        public void TrackEvent(string eventName)
        {
            bool isDebug = IsDebugRun();

            if (!isDebug)
            {
                var eventTelemetry = new EventTelemetry {
                    Name = eventName
                };
                TelemetryService.TrackEvent(eventTelemetry, isDebug);
            }
        }
Пример #4
0
        public void TrackTestExecution(string projectTrackInfo)
        {
            bool isDebug = IsDebugRun();

            try
            {
                if (!isDebug)
                {
                    projectTrackInfo = $"{projectTrackInfo}  Framework";

                    var assemblyFacade      = new AssemblyFacade();
                    var callingAssemblies   = assemblyFacade.GetAssembliesCallChain();
                    var testProjectAssembly = callingAssemblies[3];

                    if (callingAssemblies.Any(x => x.FullName.Contains("SpecFlow")))
                    {
                        projectTrackInfo = $"{projectTrackInfo} SpecFlow";
                    }

                    if (testProjectAssembly.FullName.Contains("GettingStarted"))
                    {
                        projectTrackInfo = $"{projectTrackInfo} GettingStarted";
                    }

                    var            testInfoProvider = new TestInfoProvider();
                    EventTelemetry eventTelemetry   = default;
                    int            mstestTestsCount = testInfoProvider.CountBellatrixTests(testProjectAssembly, _msTestClassAttributeName, _msTestTestAttributeName);
                    int            nunitTestsCount  = testInfoProvider.CountBellatrixTests(testProjectAssembly, _nunitTestFixtureAttributeName, _nunitTestAttributeName);
                    if (mstestTestsCount > 0)
                    {
                        eventTelemetry      = new EventTelemetry();
                        eventTelemetry.Name = "MSTest Test Run";
                        eventTelemetry.Metrics.Add(projectTrackInfo, mstestTestsCount);
                    }

                    if (nunitTestsCount > 0)
                    {
                        eventTelemetry      = new EventTelemetry();
                        eventTelemetry.Name = "NUnit Test Run";
                        eventTelemetry.Metrics.Add(projectTrackInfo, nunitTestsCount);
                    }

                    TelemetryService.TrackEvent(eventTelemetry, isDebug);
                }
            }
            catch (Exception ex)
            {
                TelemetryService.TrackException(ex, isDebug);
            }
        }
        public async Task TrackEvent_ShouldAddEvent()
        {
            await _telemetryService.TrackEvent(_httpContext);

            AssertEventEqual(_httpContext, _eventRepository.Entities.Single());
        }