public void UninstallRemovesAllTelemetryModules()
        {
            string    emptyConfig        = ConfigurationHelpers.GetEmptyConfig();
            XDocument configAfterInstall = ConfigurationHelpers.InstallTransform(emptyConfig);

            XDocument configAfterUninstall = ConfigurationHelpers.UninstallTransform(configAfterInstall.ToString());

            Assert.AreEqual(0, ConfigurationHelpers.GetTelemetryModules(configAfterUninstall).ToList().Count);
        }
        public void InstallDoesNotInstallExtraModules()
        {
            string    emptyConfig          = ConfigurationHelpers.GetEmptyConfig();
            XDocument configAfterTransform = ConfigurationHelpers.InstallTransform(emptyConfig);

            Type typeToFind = typeof(FirstChanceExceptionStatisticsTelemetryModule);

            Assert.AreEqual(5, ConfigurationHelpers.GetTelemetryModules(configAfterTransform).Descendants().Count());
        }
示例#3
0
        public void InstallAddsDiagnosticsTelemetryModule()
        {
            string    emptyConfig          = ConfigurationHelpers.GetEmptyConfig();
            XDocument configAfterTransform = ConfigurationHelpers.InstallTransform(emptyConfig);

            var nodes = ConfigurationHelpers.GetTelemetryModules(configAfterTransform).Descendants().ToList();
            var node  = nodes.FirstOrDefault(element => element.Attribute("Type").Value == "Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing.DiagnosticsTelemetryModule, Microsoft.ApplicationInsights");

            Assert.IsNotNull(node);
        }
        public void UninstallDoesNotRemoveTelemetryModulesTagIfCustomTelemetryModuleIsPresent()
        {
            string    emptyConfig        = ConfigurationHelpers.GetEmptyConfig();
            XDocument configAfterInstall = ConfigurationHelpers.InstallTransform(emptyConfig);

            // Replace valid type on custom so during uninstall it should stay in the config
            string customConfig = configAfterInstall.ToString().Replace("DeveloperModeWithDebuggerAttachedTelemetryModule", "blah");

            XDocument configAfterUninstall = ConfigurationHelpers.UninstallTransform(customConfig);

            Assert.AreEqual(1, ConfigurationHelpers.GetTelemetryModules(configAfterUninstall).ToList().Count);
            Assert.AreEqual(1, ConfigurationHelpers.GetTelemetryModules(configAfterUninstall).Descendants().ToList().Count);
        }
        public void InstallAddsUnobservedExceptionTelemetryModule()
        {
            string    emptyConfig          = ConfigurationHelpers.GetEmptyConfig();
            XDocument configAfterTransform = ConfigurationHelpers.InstallTransform(emptyConfig);

            Type typeToFind = typeof(UnobservedExceptionTelemetryModule);

            var node = ConfigurationHelpers.GetTelemetryModules(configAfterTransform)
                       .Descendants()
                       .FirstOrDefault(element => element.Attribute("Type").Value == ConfigurationHelpers.GetPartialTypeName(typeToFind));

            Assert.IsNotNull(node);
        }
示例#6
0
        public void InstallRemovesDiagnosticsTelemetryModule()
        {
            string    emptyConfig   = ConfigurationHelpers.GetEmptyConfig();
            XDocument tempTransform = ConfigurationHelpers.InstallTransform(emptyConfig);

            // Add DiagnosticsModule by replacing exsiting one
            string customConfig = tempTransform.ToString().Replace(
                ConfigurationHelpers.GetPartialTypeName(typeof(DeveloperModeWithDebuggerAttachedTelemetryModule)),
                DiagnosticsModuleName);

            XDocument configAfterTransform = ConfigurationHelpers.InstallTransform(customConfig);

            var nodes = ConfigurationHelpers.GetTelemetryModules(configAfterTransform).Descendants().ToList();
            var node  = nodes.FirstOrDefault(element => element.Attribute("Type").Value == DiagnosticsModuleName);

            Assert.IsNull(node);
        }