/// <inheritdoc /> protected override IEnumerable <IRuleViolation> Evaluate(IConfigurationProjectItem target, XDocument configurationXml) { var supportedRuntimeElement = configurationXml.XPathSelectElement("/configuration/startup/supportedRuntime"); if (supportedRuntimeElement == null) { yield return(new RuleViolation(this, target, "No explicit configuration for the supported runtime version/SKU could be found.")); } else { var version = supportedRuntimeElement.Attribute("version")?.Value; if (version != Configuration.ExpectedVersion) { yield return (new RuleViolation( this, target, $"Unexpected value for supported runtime version, was '{version}' but should be '{Configuration.ExpectedVersion}'.")); } var sku = supportedRuntimeElement.Attribute("sku")?.Value; if (sku != Configuration.ExpectedSKU) { yield return (new RuleViolation( this, target, $"Unexpected value for supported runtime SKU, was '{sku}' but should be '{Configuration.ExpectedSKU}'.")); } } }
/// <summary> /// Checks the project configuration file (<paramref name="target" />) and its contents (<paramref name="configurationXml" />). /// </summary> /// <returns></returns> protected abstract IEnumerable <IRuleViolation> Evaluate(IConfigurationProjectItem target, XDocument configurationXml);
protected override IEnumerable <IRuleViolation> Evaluate( IConfigurationProjectItem target, XDocument configurationXml) { yield return(_violation); }