protected override ConventionResult IsSatisfiedByLegacyCsprojFormat(string assemblyName, XDocument projectDocument) { var failures = ItemGroupItem.FromProjectDocument(projectDocument) .Where(itemGroupItem => itemGroupItem.MatchesPatternAndIsNotContentCopyNewest(_fileMatchRegex)) .Select(itemGroupItem => itemGroupItem.ToString()) .ToArray(); return(BuildResult(assemblyName, failures)); }
protected override ConventionResult IsSatisfiedByInternal(string assemblyName, XDocument projectDocument) { var failures = ItemGroupItem.FromProjectDocument(projectDocument) .Where(itemGroupItem => itemGroupItem.MatchesPatternAndIsNotAnEmbeddedResourceOrReference(_fileMatchRegex)) .ToArray(); if (failures.Any()) { var failureText = FailureMessage.FormatWith(_friendlyDescription, assemblyName) + Environment.NewLine + string.Join(Environment.NewLine, failures.Select(itemGroupItem => "- " + itemGroupItem.ToString())); return(ConventionResult.NotSatisfied(assemblyName, failureText)); } return(ConventionResult.Satisfied(assemblyName)); }
protected override ConventionResult IsSatisfiedByInternal(string assemblyName, XDocument projectDocument) { var files = AllMatchingFilesInFolder(ConventionTargetFolder); var failures = files.Where(file => !ItemGroupItem.FromProjectDocument(projectDocument).Any(igi => igi.MatchesAbsolutePath(file.Replace(this.ProjectFolder, "").TrimStart('\\')))) .ToArray(); if (failures.Any()) { var failureText = FailureMessage.FormatWith(_pattern, ConventionTargetFolder) + Environment.NewLine + string.Join(Environment.NewLine, failures.Select(igi => "- " + igi.ToString())); return(ConventionResult.NotSatisfied(assemblyName, failureText)); } return(ConventionResult.Satisfied(assemblyName)); }
protected override ConventionResult IsSatisfiedBy(string assemblyName, XDocument projectDocument) { var children = ItemGroupItem.FromProjectDocument(projectDocument).ToArray(); var projectFiles = DirectoryEx .GetFilesExceptOutput(ProjectFolder, "*") .Where(x => _fileMatchRegex.IsMatch(x)) .Select(x => x.Replace($"{ProjectFolder}\\", "")) .ToArray(); var failures = children .Where(itemGroupItem => itemGroupItem.MatchesPatternAndIsNotContentCopyNewest(_fileMatchRegex)) .Select(itemGroupItem => itemGroupItem.ToString()) .Union(projectFiles.Where(x => children.None(child => child.Include.Equals(x)))) .ToArray(); return(BuildResult(assemblyName, failures)); }
protected override ConventionResult IsSatisfiedBy(string assemblyName, XDocument projectDocument) { var children = ItemGroupItem.FromProjectDocument(projectDocument).ToArray(); var projectFiles = DirectoryEx .GetFilesExceptOutput(ProjectFolder, "*") .Where(x => _fileMatchRegex.IsMatch(x)) .Select(x => x.Replace($"{ProjectFolder}{Path.DirectorySeparatorChar}", "")) .ToArray(); var normalisedUpdates = children.Select(c => c.Update.Replace('\\', Path.DirectorySeparatorChar)); var failures = children .Where(itemGroupItem => itemGroupItem.MatchesPatternAndIsNotAnEmbeddedResource(_fileMatchRegex)) .Select(itemGroupItem => itemGroupItem.ToString()) .Union(projectFiles.Where(x => normalisedUpdates.None(update => update.Equals(x)))) .ToArray(); return(BuildResult(assemblyName, failures, "Embedded Resource")); }
protected override ConventionResult IsSatisfiedByLegacyCsprojFormat(string assemblyName, XDocument projectDocument) { var files = AllMatchingFilesInFolder(ConventionTargetFolder); var normalisedIncludes = ItemGroupItem.FromProjectDocument(projectDocument) .Select(item => item.Include.Replace('\\', Path.DirectorySeparatorChar)); var failures = files.Where(file => normalisedIncludes.None(include => include == file.Replace(ProjectFolder, "").TrimStart(Path.DirectorySeparatorChar))) .ToArray(); if (failures.Any()) { var failureText = FailureMessage.FormatWith(_pattern, ConventionTargetFolder) + Environment.NewLine + string.Join(Environment.NewLine, failures.Select(igi => "- " + igi.ToString())); return(ConventionResult.NotSatisfied(assemblyName, failureText)); } return(ConventionResult.Satisfied(assemblyName)); }