Пример #1
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);
        }
        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);
        }
Пример #3
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));
        }
Пример #4
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);
        }
Пример #5
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);
        }