/// <summary> /// Based on value set in configuration file this method will return the instance /// of page repository /// </summary> /// <param name="repositoryValue">string value set in config file</param> /// <returns>IPageRepository instance</returns> public IPageRepository GetRepository(PageRepositoryValue repositoryValue) { IPageRepository repository = null; try { switch (repositoryValue) { case PageRepositoryValue.PageRepository: repository = new PageRepository(); break; case PageRepositoryValue.PageMockRepository: repository = new PageMockRepository(); break; default: repository = new PageMockRepository(); break; } } catch (Exception ex) { _logger.Error("Uncaught exception in GetRepository Method.", ex); } return(repository); }
/// <summary> /// This method gets the page object from datasource /// </summary> /// <returns>High level html</returns> public HighLevelHtml GetPage() { PageFactory pageFactory = new PageFactory(); try { string configValue = Utility.GetConfigurationValue(Constants.PageRepository); PageRepositoryValue repositoryValue = (PageRepositoryValue)Enum.Parse(typeof(PageRepositoryValue), configValue); IPageRepository repository = pageFactory.GetRepository(repositoryValue); var page = repository.GetPage(); return(_htmlTranslator.ConstructHighLevelHtml(page)); } catch (Exception ex) { _logger.Error("Uncaught exception in GetPage Method execution.", ex); } return(null); }