private void AssertIssue(PackageIssue packageIssue, string file)
 {
     file = PathFixUtility.FixPath(file);
     Assert.Equal("Init.ps1 script will be ignored.", packageIssue.Title);
     Assert.Equal("Place the file directly under 'tools' folder.", packageIssue.Solution);
     Assert.Equal("The file '" + file + "' will be ignored by NuGet because it is not directly under 'tools' folder.", packageIssue.Description);
 }
 private void AssertPackageIssueWithPath(PackageIssue issue, string target)
 {
     PackageIssueTestHelper.AssertPackageIssue(
         issue,
         "Incompatible files in lib folder.",
         "The file '" + target + "' is not a valid assembly. If it is an XML documentation file or a .pdb file, there is no matching assembly specified in the same folder.",
         "Either remove this file from 'lib' folder or add a matching .dll for it.");
 }
 public IEnumerable<PackageIssue> Validate(IPackage package)
 {
     if (!IsValidSemanticVersionAccordingToSpec(package))
     {
         string description = string.Format(CultureInfo.InvariantCulture, Strings.SemanticVersionRule_IssueDescription, package.Id, package.Version);
         var issue = new PackageIssue(Strings.SemanticVersionRule_IssueTitle, description, Strings.SemanticVersionRule_IssueSolution, PackageIssueLevel.Error);
         return new ReadOnlyCollection<PackageIssue>(new[] { issue });
     }
     return Enumerable.Empty<PackageIssue>();
 }
        public static void AssertPackageIssue(
            PackageIssue issue,
            string expectedTitle,
            string expectedDescription,
            string expectedSolution)
        {

            Assert.Equal(expectedTitle, issue.Title);
            Assert.Equal(expectedDescription, issue.Description);
            Assert.Equal(expectedSolution, issue.Solution);
        }
        public static IEnumerable<PackageIssue> Validate(this IPackage package, IEnumerable<IPackageRule> rules, string packageSource)
        {
            foreach (IPackageRule rule in rules)
            {
                if (rule != null)
                {
                    PackageIssue[] issues = null;
                    try
                    {
                        issues = rule.Validate(package, packageSource).ToArray();
                    }
                    catch (Exception)
                    {
                        issues = new PackageIssue[0];
                    }

                    // can't yield inside a try/catch block
                    foreach (PackageIssue issue in issues)
                    {
                        yield return issue;
                    }
                }
            }
        }
Exemple #6
0
        private void PrintPackageIssue(PackageIssue issue)
        {
            Console.WriteLine();
            Console.WriteWarning(
                prependWarningText: false,
                value: NuGetResources.PackageCommandIssueTitle,
                args: issue.Title);

            Console.WriteWarning(
                prependWarningText: false,
                value: NuGetResources.PackageCommandIssueDescription,
                args: issue.Description);

            if (!String.IsNullOrEmpty(issue.Solution))
            {
                Console.WriteWarning(
                    prependWarningText: false,
                    value: NuGetResources.PackageCommandIssueSolution,
                    args: issue.Solution);
            }
        }
        private void PrintPackageIssue(PackageIssue issue)
        {
            Console.WriteLine();
            Console.WriteWarning(
                prependWarningText: false,
                value: LocalizedResourceManager.GetString("PackageCommandIssueTitle"),
                args: issue.Title);

            Console.WriteWarning(
                prependWarningText: false,
                value: LocalizedResourceManager.GetString("PackageCommandIssueDescription"),
                args: issue.Description);

            if (!String.IsNullOrEmpty(issue.Solution))
            {
                Console.WriteWarning(
                    prependWarningText: false,
                    value: LocalizedResourceManager.GetString("PackageCommandIssueSolution"),
                    args: issue.Solution);
            }
        }
Exemple #8
0
 private void AssertIssue(PackageIssue packageIssue, string file)
 {
     Assert.Equal("Init.ps1 script will be ignored.", packageIssue.Title);
     Assert.Equal("Place the file directly under 'tools' folder.", packageIssue.Solution);
     Assert.Equal("The file '" + file + "' will be ignored by NuGet because it is not directly under 'tools' folder.", packageIssue.Description);
 }