public ContentObjectService(IContentService contentService)
        {
            _contentService = contentService;

            LoginDiscontinuationConfiguration = new LoginDiscontinuationConfiguration();
            CertificatesConfiguration         = new CertificatesConfiguration();
            SymbolsConfiguration       = new SymbolsConfiguration();
            TyposquattingConfiguration = new TyposquattingConfiguration();
            ABTestConfiguration        = new ABTestConfiguration();
        }
Пример #2
0
        public ContentObjectService(IContentService contentService)
        {
            _contentService = contentService;

            LoginDiscontinuationConfiguration = new LoginDiscontinuationConfiguration();
            CertificatesConfiguration         = new CertificatesConfiguration();
            SymbolsConfiguration       = new SymbolsConfiguration();
            TyposquattingConfiguration = new TyposquattingConfiguration();
            GitHubUsageConfiguration   = new GitHubUsageConfiguration(Array.Empty <RepositoryInformation>());
            ABTestConfiguration        = new ABTestConfiguration();
            ODataCacheConfiguration    = new ODataCacheConfiguration();
        }
Пример #3
0
        private ABTestConfiguration ParseABTestingConfiguration(string xml, IClientUrlBuilder clientUrlInfo, IWebClient webClient)
        {
            var xmlDoc = XmlUtils.Parse(xml);

            var root = xmlDoc.Root;

            var abTestConfiguration = new ABTestConfiguration(root.GetAttributeValue("ID"),
                                                              root.GetAttributeValue("Name"),
                                                              root.GetAttributeValue("Description"));


            foreach (var testCasesElement in root.Elements("test_cases"))
            {
                var testCasesCollection = new ABTestCaseSet(abTestConfiguration.Id,
                                                            testCasesElement.GetAttributeValue("brand"),
                                                            testCasesElement.GetAttributeValue("skin"),
                                                            testCasesElement.GetAttributeValue("lang"));

                foreach (var tcElement in testCasesElement.Elements("test_case"))
                {
                    var abTest = new ABTestCase(tcElement.GetAttributeValue("ID"),
                                                tcElement.GetAttributeValue <bool>("IsDefault"),
                                                tcElement.GetAttributeValue <ABTestMethod>("Method"),
                                                tcElement.GetAttributeValue("Name"),
                                                tcElement.GetAttributeValue <decimal>("UsePercentage"),
                                                tcElement.GetAttributeValue("Description"),
                                                new PathDescriptor(tcElement.GetAttributeValue("ClientPath")));


                    if (abTest.Method == ABTestMethod.Override)
                    {
                        abTest.FilesOverride = ReadFilesOverride(webClient, clientUrlInfo, abTest.ClientPath);
                    }

                    testCasesCollection.Add(abTest);
                }

                if (testCasesCollection.Count > 0)
                {
                    abTestConfiguration.TestCaseSets.Add(testCasesCollection);
                }
            }

            return(abTestConfiguration);
        }
Пример #4
0
        private ABTestConfiguration ParseABTestingConfiguration(string abTestConfigContent)
        {
            var languageJson = JsonConvert.DeserializeObject <dynamic>(abTestConfigContent);

            var config = new ABTestConfiguration();

            if (languageJson.abTests == null)
            {
                return(config);
            }

            foreach (var abTestElement in languageJson.abTests)
            {
                config.Id          = ConvertDynamicValue <string>(abTestElement.ID);
                config.Name        = ConvertDynamicValue <string>(abTestElement.Name);
                config.Description = ConvertDynamicValue <string>(abTestElement.Description);

                if (abTestElement.testCasesSets == null)
                {
                    continue;
                }

                foreach (var testCaseSetElement in abTestElement.testCasesSets)
                {
                    var testCaseSet = new ABTestCaseSet(ConvertDynamicValue <string>(testCaseSetElement.id),
                                                        ConvertDynamicValue <string>(testCaseSetElement.brand),
                                                        ConvertDynamicValue <string>(testCaseSetElement.skin),
                                                        ConvertDynamicValue <string>(testCaseSetElement.lang));

                    if (testCaseSetElement.testCases == null)
                    {
                        continue;
                    }

                    foreach (var testCaseElement in testCaseSetElement.testCases)
                    {
                        var testCase = new ABTestCase(ConvertDynamicValue <string>(testCaseElement.ID),
                                                      ConvertDynamicValue <bool>(testCaseElement.isDefault),
                                                      ConvertDynamicValue <ABTestMethod>(testCaseElement.Method),
                                                      ConvertDynamicValue <string>(testCaseElement.Name),
                                                      ConvertDynamicValue <decimal>(testCaseElement.UsePercentage),
                                                      ConvertDynamicValue <string>(testCaseElement.Description),
                                                      new PathDescriptor(ConvertDynamicValue <string>(testCaseElement.ClientFolder)));


                        if (null != ((JObject)testCaseElement)?.Property("configurationPaths"))
                        {
                            if (null != ((JObject)testCaseElement.configurationPaths)?.Property("navigationPlanPath"))
                            {
                                testCase.FilesOverride.Add(new ABTestFileOverride(_defaultNavigationPlanPath, ConvertDynamicValue <string>(testCaseElement.configurationPaths.navigationPlanPath)));
                            }
                        }

                        testCaseSet.Add(testCase);
                    }

                    config.TestCaseSets.Add(testCaseSet);
                }
            }


            return(config);
        }