Esempio n. 1
0
        public bool AppliesTo(SkinCode skinCode, IEnumerable <IConfigurationFileDescriptor> fileDescriptors)
        {
            if (this.Any(t => t.Method == ABTestMethod.FullClient))
            {
                return(true);
            }

            foreach (var test in this.Where(t => t.Method == ABTestMethod.Override))
            {
                if (fileDescriptors.Any(fd => test.IsFileAffected(fd, skinCode)))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 2
0
        public PathDescriptor GetOverrideFileOrNull(PathDescriptor fileRelativePath, SkinCode skinCode)
        {
            if (this.Method == ABTestMethod.FullClient)
            {
                return(fileRelativePath);
            }

            foreach (var fileOverride in this.FilesOverride)
            {
                if (fileOverride.GetOriginalFile(skinCode).EndsWith(fileRelativePath))
                {
                    return(fileOverride.OverrideFile);
                }
            }


            return(null);
        }
Esempio n. 3
0
        public ABTestCaseSet[] GetApplicableTestCases(SkinCode skinCode)
        {
            var testCases = TestCaseSets.Where(tc => tc.BrandId == skinCode.BrandId.ToString() && tc.SkinId == skinCode.SkinId.ToString())
                            .ToArray();

            if (testCases.Length > 0)
            {
                return(testCases);
            }

            testCases = TestCaseSets.Where(tc => tc.BrandId == skinCode.BrandId.ToString() && tc.SkinId == "*")
                        .ToArray();

            if (testCases.Length > 0)
            {
                return(testCases);
            }


            testCases = TestCaseSets.Where(tc => tc.BrandId == "*" && tc.SkinId == skinCode.SkinId.ToString())
                        .ToArray();

            if (testCases.Length > 0)
            {
                return(testCases);
            }


            testCases = TestCaseSets.Where(tc => tc.BrandId == "*" && tc.SkinId == "*")
                        .ToArray();

            if (testCases.Length > 0)
            {
                return(testCases);
            }

            return(new ABTestCaseSet[0]);
        }
Esempio n. 4
0
 public PathDescriptor GetOriginalFile(SkinCode skinCode)
 {
     return(_originalFile.Replace("%BRAND%", skinCode.BrandId.ToString())
            .Replace("%SKIN%", skinCode.SkinId.ToString()));
 }
Esempio n. 5
0
 public PathDescriptor GetOverrideFileOrNull(IConfigurationFileDescriptor fileDescriptor, SkinCode skinCode)
 {
     return(GetOverrideFileOrNull(fileDescriptor.GetRelativePath(skinCode), skinCode));
 }
Esempio n. 6
0
 public bool IsFileAffected(IConfigurationFileDescriptor fileDescriptor, SkinCode skinCode)
 {
     return(null != GetOverrideFileOrNull(fileDescriptor, skinCode));
 }