コード例 #1
0
        public IEnumerable <PackageVerifierIssue> Validate(PackageAnalysisContext context)
        {
            var discoveredTypes = context.Metadata.PackageTypes.Select(t => t.Name);
            var expectedTypes   = context.Options?.PackageTypes ?? Enumerable.Empty <string>();

            foreach (var missing in expectedTypes.Except(discoveredTypes))
            {
                yield return(PackageIssueFactory.PackageTypeMissing(missing));
            }

            foreach (var unexpected in discoveredTypes.Except(expectedTypes))
            {
                yield return(PackageIssueFactory.PackageTypeUnexpected(unexpected));
            }
        }