Exemplo n.º 1
0
        public void CorrectId_GetHelpLink_ReturnsCorrectUri(string analyzerId)
        {
            var expected = $"http://kentico.github.io/bug-hunter/{analyzerId}.html";
            var actual   = HelpLinkUriProvider.GetHelpLink(analyzerId);

            Assert.AreEqual(expected, actual);
        }
 /// <summary>
 /// Constructs a <see cref="DiagnosticDescriptor"/> for String manipulation methods Analyzer.
 /// </summary>
 /// <remarks>
 /// Analyzer will have provided diagnostic ID, StringAndCulture category,
 /// Warning severity, HelperLinkUri, and will be enabled by default
 /// </remarks>
 /// <param name="diagnosticId">Diagnostic ID of the rule</param>
 /// <returns>Diagnostic descriptor for String manipulation analyzer</returns>
 public static DiagnosticDescriptor CreateRuleForManipulationMethods(string diagnosticId)
 => new DiagnosticDescriptor(
     diagnosticId,
     title: new LocalizableResourceString(nameof(StringMethodsResources.StringManipulationMethods_Title), StringMethodsResources.ResourceManager, typeof(StringMethodsResources)),
     messageFormat: new LocalizableResourceString(nameof(StringMethodsResources.StringManipulationMethods_MessageFormat), StringMethodsResources.ResourceManager, typeof(StringMethodsResources)),
     category: nameof(AnalyzerCategories.StringAndCulture),
     defaultSeverity: DiagnosticSeverity.Warning,
     isEnabledByDefault: true,
     description: new LocalizableResourceString(nameof(StringMethodsResources.StringManipulationMethods_Description), StringMethodsResources.ResourceManager, typeof(StringMethodsResources)),
     helpLinkUri: HelpLinkUriProvider.GetHelpLink(diagnosticId));
Exemplo n.º 3
0
        [TestCase("BH*123")]  // ID must not contain special characters

        public void IdInIncorrectFormat_GetHelpLink_ThrowsAnException(string incorrectId)
        {
            Assert.Throws <ArgumentException>(() => HelpLinkUriProvider.GetHelpLink(incorrectId));
        }
Exemplo n.º 4
0
 public void Null_GetHelpLink_ThrowsAnException(string emptyId)
 {
     Assert.Throws <ArgumentException>(() => HelpLinkUriProvider.GetHelpLink(emptyId));
 }