Пример #1
0
        /// <summary>
        /// Gets the data that should be shown in the UI.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns>Object that will be shown.</returns>
        public override object GetData(ITabContext context)
        {
            var result = new ConfigurationModel();
            result.AppSettings = ConfigurationManager.AppSettings.ToDictionary();
            result.Authentication = ProcessAuthenticationSection(ConfigurationManager.GetSection("system.web/authentication") as AuthenticationSection);
            result.ConnectionStrings = ProcessConnectionString(ConfigurationManager.ConnectionStrings);
            result.CustomErrors = ProcessCustomErrors(ConfigurationManager.GetSection("system.web/customErrors") as CustomErrorsSection);
            result.HttpModules = ProcessHttpModules(ConfigurationManager.GetSection("system.web/httpModules") as HttpModulesSection);
            result.HttpHandlers = ProcessHttpHandler(ConfigurationManager.GetSection("system.web/httpHandlers") as HttpHandlersSection);
            result.RoleManager = ProcessRoleManager(ConfigurationManager.GetSection("system.web/roleManager") as RoleManagerSection);

            return result;
        }
        public void ConvertToList()
        {
            var model = new ConfigurationModel();
            model.AppSettings = new Dictionary<string, string> { { "Test", "Pest" }, { "Jester", "Wester" } };
            model.Authentication = new ConfigurationAuthenticationModel();
            model.ConnectionStrings = new List<ConfigurationConnectionStringModel> { new ConfigurationConnectionStringModel(), new ConfigurationConnectionStringModel() };
            model.CustomErrors = new ConfigurationCustomErrorsModel();
            model.HttpHandlers = new List<ConfigurationHttpHandlersModel> { new ConfigurationHttpHandlersModel(), new ConfigurationHttpHandlersModel() };
            model.HttpModules = new List<ConfigurationHttpModulesModel> { new ConfigurationHttpModulesModel(), new ConfigurationHttpModulesModel() };
            model.RoleManager = new ConfigurationRoleManagerModel();

            var converter = new ConfigurationModelConverter();
            var result = converter.Convert(model) as IDictionary<object, object>;
             
            Assert.NotNull(result);
            Assert.True(result.Count > 0); 
        }