public void CanGetCategoryHelpTextFromArbitraryResource()
        {
            PerformanceCountersDefinitionAttribute attribute = new PerformanceCountersDefinitionAttribute("category", "CategoryHelpFromArbitraryResource");
            string translatedHelp = PerformanceCounterInstallerBuilder.GetCategoryHelp(attribute, this.GetType().Assembly);

            Assert.AreEqual(ExtraResources.CategoryHelpFromArbitraryResource, translatedHelp);
        }
        private void PopulateCounterCategoryData(PerformanceCountersDefinitionAttribute attribute, Assembly originalAssembly, PerformanceCounterInstaller installer)
        {
            installer.CategoryName = attribute.CategoryName;
            installer.CategoryHelp = GetCategoryHelp(attribute, originalAssembly);

            installer.CategoryType = attribute.CategoryType;
        }
        public void CanGetCategoryHelpTextForNonExistingName()
        {
            PerformanceCountersDefinitionAttribute attribute = new PerformanceCountersDefinitionAttribute("category", "MissingCategoryHelp");
            string translatedHelp = PerformanceCounterInstallerBuilder.GetCategoryHelp(attribute, this.GetType().Assembly);

            Assert.AreEqual(string.Empty, translatedHelp);
        }
		private void PopulateCounterCategoryData(PerformanceCountersDefinitionAttribute attribute, Assembly originalAssembly, PerformanceCounterInstaller installer)
		{
			installer.CategoryName = attribute.CategoryName;
			installer.CategoryHelp = GetCategoryHelp(attribute, originalAssembly);

			installer.CategoryType = attribute.CategoryType;
		}
        /// <summary>
        /// Gets the category help for a performance counter.
        /// </summary>
        /// <param name="attribute">The performance counter attribute.</param>
        /// <param name="originalAssembly">The assembly where the help is defined.</param>
        /// <returns>The help for the performance counter.</returns>
        public static string GetCategoryHelp(PerformanceCountersDefinitionAttribute attribute,
                                             Assembly originalAssembly)
        {
            if (attribute == null)
            {
                throw new ArgumentNullException("attribute");
            }

            return(GetResourceString(attribute.CategoryHelp, originalAssembly));
        }
        PerformanceCounterInstaller GetOrCreateInstaller(Type instrumentedType,
                                                         ICollection <Installer> installers)
        {
            PerformanceCountersDefinitionAttribute attribute
                = (PerformanceCountersDefinitionAttribute)instrumentedType.GetCustomAttributes(typeof(PerformanceCountersDefinitionAttribute), false)[0];
            PerformanceCounterInstaller installer = GetExistingInstaller(attribute.CategoryName, installers);

            if (installer == null)
            {
                installer = new PerformanceCounterInstaller();
                PopulateCounterCategoryData(attribute, instrumentedType.Assembly, installer);
                installers.Add(installer);
            }
            return(installer);
        }
 internal static string GetCategoryHelp(PerformanceCountersDefinitionAttribute attribute, Assembly originalAssembly)
 {
     return GetResourceString(attribute.CategoryHelp, originalAssembly);
 }
 internal static string GetCategoryHelp(PerformanceCountersDefinitionAttribute attribute, Assembly originalAssembly)
 {
     return(GetResourceString(attribute.CategoryHelp, originalAssembly));
 }
        /// <summary>
        /// Gets the category help for a performance counter.
        /// </summary>
        /// <param name="attribute">The performance counter attribute.</param>
        /// <param name="originalAssembly">The assembly where the help is defined.</param>
        /// <returns>The help for the performance counter.</returns>
        public static string GetCategoryHelp(PerformanceCountersDefinitionAttribute attribute,
                                             Assembly originalAssembly)
        {
            if (attribute == null) throw new ArgumentNullException("attribute");

            return GetResourceString(attribute.CategoryHelp, originalAssembly);
        }