示例#1
0
        public void UninstallRemovesAllTelemetryInitailizers()
        {
            string    emptyConfig        = ConfigurationHelpers.GetEmptyConfig();
            XDocument configAfterInstall = ConfigurationHelpers.InstallTransform(emptyConfig);

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

            Assert.AreEqual(0, ConfigurationHelpers.GetTelemetryInitializers(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);
        }
示例#4
0
        public void InstallAddsAzureRoleEnvironmentTelemetryInitializer()
        {
            string    emptyConfig          = ConfigurationHelpers.GetEmptyConfig();
            XDocument configAfterTransform = ConfigurationHelpers.InstallTransform(emptyConfig);

            Type typeToFind = typeof(AzureRoleEnvironmentTelemetryInitializer);

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

            Assert.IsNotNull(node);
        }
示例#5
0
        public void InstallDoesNotAddDeviceTelemetryInitializerByDefault()
        {
            string    emptyConfig          = ConfigurationHelpers.GetEmptyConfig();
            XDocument configAfterTransform = ConfigurationHelpers.InstallTransform(emptyConfig);

            Type typeToFind = typeof(DeviceTelemetryInitializer);

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

            Assert.IsNull(node);
        }
示例#6
0
        public void UninstallDoesNotRemovesTelemetryInitailizersTagIfCustomTelemetryInitializerPresent()
        {
            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("BuildInfoConfigComponentVersionTelemetryInitializer", "blah");

            XDocument configAfterUninstall = ConfigurationHelpers.UninstallTransform(customConfig);

            Assert.AreEqual(1, ConfigurationHelpers.GetTelemetryInitializers(configAfterUninstall).ToList().Count);
            Assert.AreEqual(1, ConfigurationHelpers.GetTelemetryInitializers(configAfterUninstall).Descendants().ToList().Count);
        }
        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);
        }
示例#9
0
        public void InstallAddsAzureSpecificInitializerFirstSoItIsFirstToFillCommonProperties()
        {
            string    emptyConfig          = ConfigurationHelpers.GetEmptyConfig();
            XDocument configAfterTransform = ConfigurationHelpers.InstallTransform(emptyConfig);

            Type typeToFind1 = typeof(AzureRoleEnvironmentTelemetryInitializer);
            Type typeToFind2 = typeof(AzureWebAppRoleEnvironmentTelemetryInitializer);

            var node = ConfigurationHelpers.GetTelemetryInitializers(configAfterTransform)
                       .Descendants()
                       .Where(element =>
                              element.Attribute("Type").Value == ConfigurationHelpers.GetPartialTypeName(typeToFind1) ||
                              element.Attribute("Type").Value == ConfigurationHelpers.GetPartialTypeName(typeToFind2))
                       .ToList();

            Assert.AreEqual(node[0].Attribute("Type").Value, ConfigurationHelpers.GetPartialTypeName(typeToFind1));
        }
示例#10
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);
        }