/// <summary>
        /// 创建新的模拟环境。
        /// 注意采用using(ImpersonateUserHelper helper = ImpersonateUserHelper.NewImpersonateUserHelper()){}方式调用,以确保用完马上释放资源。
        /// </summary>
        /// <returns></returns>
        public static ImpersonateUserHelper NewImpersonateUserHelper()
        {
            string accountName = ConfigUtility.GetFrameworkConfigValue("ImpersonateUserAccount", "配置用户模拟所用的帐号");
            string password    = ConfigUtility.GetFrameworkConfigValue("ImpersonateUserPassword", "配置用户模拟所用帐号的密码");
            string domain      = ConfigUtility.GetFrameworkConfigValue("ImpersonateUserDomain", "用户模拟所用的帐号的域");
            var    helper      = new ImpersonateUserHelper(accountName, password, domain);

            return(helper);
        }
示例#2
0
        public void ConfigUitilyTest()
        {
            TestContext.WriteLine(ConfigUtility.GetFrameworkConfigValue("LoginServiceBusPassword", ""));
            var sec = ConfigUtility.GetFrameworkConfigSections("GoogleMailSetting", "邮箱配置");

            foreach (var configSection in sec)
            {
                TestContext.WriteLine(configSection.SectionType);
            }

            TestContext.WriteLine(ConfigUtility.GetSystemConfigValue("log4net.Config", "log4日志", false));
            TestContext.WriteLine(ConfigUtility.GetSystemConnectionStringsConfigValue("SHIPING_OA", "log4日志", false));
        }