B4BCore.Internal.CdnInfo.FindMissingPropertiesNeededByHtmlInclude C# (CSharp) Метод

FindMissingPropertiesNeededByHtmlInclude() публичный Метод

This checks all the properties provided in the CDN object against the replace strings needed by the cdnHtmlFormatString
public FindMissingPropertiesNeededByHtmlInclude ( string cdnHtmlFormatString ) : IEnumerable
cdnHtmlFormatString string
Результат IEnumerable
        public IEnumerable<string> FindMissingPropertiesNeededByHtmlInclude(string cdnHtmlFormatString)
        {
            if (Development == null)
                yield return CdnObjectDevelopmentPropertyName;
            if (Production == null)
                yield return CdnObjectProductionPropertyName;

            var extractedReplaces = MatchReplace.Matches(cdnHtmlFormatString).Cast<Match>().Select(m => m.Value)
                .Where(x => x != CdnHtmlIncludeFileUrlReplaceString && x != FileTypeConfigInfo.CachebusterParam)
                .ToList();

            var propsWithCurlyBrackets = OtherProperties.Select(x => "{" + x.Name + "}").ToList();

            foreach (var missingReplace in extractedReplaces.Where(x => !propsWithCurlyBrackets.Contains(x)))
            {
                yield return missingReplace.Substring(1, missingReplace.Length - 2);
            }
        }

Usage Example

Пример #1
0
        public void TestValidateCdnInfoOk()
        {
            //SETUP
            var jObject = JObject.Parse(@"{
              ""development"": ""lib/jquery/dist/jquery.js"",
              ""production"": ""jquery.min.js"",
              ""cdnUrl"": ""https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"",
              ""cdnSuccessTest"": ""window.jQuery""
            }");
            var cdn = new CdnInfo("Unit Test", jObject);

            //ATTEMPT
            var missingParams = cdn.FindMissingPropertiesNeededByHtmlInclude(JsCdnHtmlInclude);

            //VERIFY
            missingParams.Any().ShouldEqual(false);
        }
All Usage Examples Of B4BCore.Internal.CdnInfo::FindMissingPropertiesNeededByHtmlInclude