示例#1
0
        private static void LoadData(string dataFile, VerticalTestData data)
        {
            // Load the data file.

            var element = XElement.Load(dataFile);

            data.Id   = GetGuidValue(element.Element("Id"));
            data.Name = GetValue(element.Element("Name"));

            foreach (var childElement in element.Elements())
            {
                if (childElement.Name != "Id" && childElement.Name != "Name")
                {
                    data.Add(childElement.Name.LocalName, childElement.Value);
                }
            }

            // Load other files.

            foreach (var file in Directory.GetFiles(Path.GetDirectoryName(dataFile)))
            {
                var fileName = Path.GetFileNameWithoutExtension(file);
                if (fileName != "VerticalData")
                {
                    data.Add(fileName, File.ReadAllText(file));
                }
            }
        }
示例#2
0
        public static Vertical CreateTestVertical(this VerticalTestData data, IVerticalsCommand verticalsCommand, IContentEngine contentEngine)
        {
            if (data.Id != null)
            {
                var vertical = new Vertical
                {
                    Id                           = data.Id.Value,
                    Name                         = data.Name,
                    Url                          = data.Url,
                    Host                         = data.Host,
                    SecondaryHost                = data.SecondaryHost,
                    TertiaryHost                 = data.TertiaryHost,
                    CountryId                    = data.CountryId,
                    RequiresExternalLogin        = data.RequiresExternalLogin,
                    ExternalLoginUrl             = data.ExternalLoginUrl,
                    ExternalCookieDomain         = data.ExternalCookieDomain,
                    EmailDisplayName             = data.EmailDisplayName,
                    ReturnEmailAddress           = data.ReturnEmailAddress,
                    MemberServicesEmailAddress   = data.MemberServicesEmailAddress,
                    EmployerServicesEmailAddress = data.EmployerServicesEmailAddress
                };
                verticalsCommand.CreateVertical(vertical);

                if (contentEngine != null)
                {
                    contentEngine.CreateContent(vertical.Id, data.Header, data.Footer, data.HomePageTitle, data.ImageRootFolder, data.CandidateImageRelativePath, data.FaviconRelativePath);
                }
                return(vertical);
            }

            // Default, so just create the content.

            if (contentEngine != null)
            {
                contentEngine.CreateContent(null, data.Header, data.Footer, data.HomePageTitle, data.ImageRootFolder, data.CandidateImageRelativePath, data.FaviconRelativePath);
            }
            return(null);
        }