Пример #1
0
        static void Main()
        {
            string path     = AppConfigReader.Get("log_path");
            string filename = Path.Combine(path, string.Format("{0}.log", DateTime.Now.ToString("yyyyMMddhhmmss")));

            ContextoActual = new Contexto(filename, FechaHelper.Ahora());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            try
            {
                ContextoActual.Logger.Iniciar();
                Application.Run(new FrmPrincipal());
            }
            catch (Exception ex)
            {
                MensajePorPantalla.MensajeError("Ha ocurrido un error fatal. Revise el archivo de log para obtener más información al respecto.");
                ContextoActual.Logger.Log(ex);
            }
            finally
            {
                ContextoActual.Logger.Finalizar();
            }
        }
Пример #2
0
        static Config()
        {
            var config = new AppConfigReader();

            NuGetUrl = config.Get <string>("NuGet.Url");
            TfsUrl   = config.Get <string>("Tfs.Url");
        }
Пример #3
0
 public WeatherAPITest()
 {
     config    = new AppConfigReader();
     apiCaller = new ApiCaller(config);
     manager   = new DataManager();
     manager.DeserializeWeather(apiCaller.GetWheatherReport("london"));
 }
Пример #4
0
        public void GetConfigurationValueWorksWithMachineSection()
        {
            // --- Arrange
            var handler = new AppConfigReader();

            // --- Act
            AppConfigReader.PretendMachine("TestMachine");
            string value1;
            var    found1 = handler.GetConfigurationValue("NonExistingCategory", "key", out value1);
            string value2;
            var    found2 = handler.GetConfigurationValue("Category1", "NonExistingKey", out value2);
            string value3;
            var    found3 = handler.GetConfigurationValue("Category1", "Key2", out value3);

            AppConfigReader.PretendMachine("StagingMachine");
            string value4;
            var    found4 = handler.GetConfigurationValue("Category1", "Key2", out value4);

            AppConfigReader.PretendMachine("Unknown");
            string value5;
            var    found5 = handler.GetConfigurationValue("Category1", "Key2", out value5);

            // --- Assert
            found1.ShouldBeFalse();
            found2.ShouldBeFalse();
            found3.ShouldBeTrue();
            value3.ShouldBe("Hello-Test");
            found4.ShouldBeTrue();
            value4.ShouldBe("Hello-Staging");
            found5.ShouldBeTrue();
            value5.ShouldBe("Hello");
        }
Пример #5
0
 private void frmPrincipal_Load_CargarBarraEstado()
 {
     this.lblUsuario.Text          = "Usuario: " + Program.ContextoActual.UsuarioActual.Username;
     this.lblLogPath.Text          = "Almacenando log en: " + Program.ContextoActual.LogPath;
     this.lblFechaSistema.Text     = "Fecha: " + FechaHelper.Format(Program.ContextoActual.FechaActual);
     this.lblConnectionString.Text = "Conectado: " + AppConfigReader.Get("connection_string");
 }
Пример #6
0
 private void Inicio_Load_CargarBarrasDeEstado()
 {
     this.lblUsuario.Text = "Usuario: " + Program.ContextoActual.UsuarioActual.username;
     //this.lblLogPath.Text = "Almacenando log en: " + Program.ContextoActual.LogPath;
     this.lblFechaSistema.Text     = "Fecha: " + DateManager.Format(Program.ContextoActual.FechaActual);
     this.lblConnectionString.Text = "Conectado: " + AppConfigReader.Get("connection_string");
 }
Пример #7
0
        /// <summary>
        /// 根据类别得到通用模板列表
        /// </summary>
        /// <param name="catalog">模板类别</param>
        /// <returns></returns>
        public DataTable GetTemplate(string catalog, string deptCode)
        {
            string auditConfig    = AppConfigReader.GetAppConfig("TempletAuditConfig").Config;
            string newEmrShowType = AppConfigReader.GetAppConfig("NewEmrShowType").Config;//1:按照病种分组  2:不进行分组
            string sqlGetTemplate = string.Empty;

            if (auditConfig.Split('-')[0] == "1")
            {
                if (newEmrShowType == "1")
                {
                    sqlGetTemplate = sql_queryTemplateAudited + " order by ordername ";
                }
                else
                {
                    sqlGetTemplate = sql_queryTemplateAudited + " order by mr_name ";
                }
            }
            else
            {
                if (newEmrShowType == "1")
                {
                    sqlGetTemplate = sql_queryTemplate + " order by ordername ";
                }
                else
                {
                    sqlGetTemplate = sql_queryTemplate + " order by mr_name ";
                }
            }
            DataTable dt = m_app.SqlHelper.ExecuteDataTable(string.Format(sqlGetTemplate, catalog, deptCode));

            //GetActuralTemplate(dt);
            return(dt);
        }
Пример #8
0
        private static void LoadAppSettingsItems()
        {
            // Use both operations now
            var selectedOperations = new List <string>
            {
                AppSettingsConstants.OperationTypeConvertPdf,
                AppSettingsConstants.OperationTypePageCount
            };

            AppSettingsItems = new Dictionary <string, object>
            {
                { AppSettingsConstants.Source, AppSettingsConstants.InputSource.Directory },
                { AppSettingsConstants.SelectedOperations, selectedOperations },
                { AppSettingsConstants.FileTypeForConvertToPdf, InfoConstants.DocImageBoth },

                { AppSettingsConstants.InputPath, AppConfigReader.GetInputPath() },
                { AppSettingsConstants.RootOutputPath, AppConfigReader.GetRootOutputPath() },
                { AppSettingsConstants.RootLogPath, AppConfigReader.GetRootLogPath() },
                { AppSettingsConstants.OutputPath, "" },
                { AppSettingsConstants.LogPath, "" },

                { AppSettingsConstants.EnableCombinedLogAndReport, AppConfigReader.EnableCombinedLogAndReport() },
                { AppSettingsConstants.CombinedOutputPath, AppConfigReader.GetCombinedOutputPath() },
                { AppSettingsConstants.CombinedSummaryLogPath, AppConfigReader.GetCombinedSummaryLogPath() },
                { AppSettingsConstants.CombinedErrorLogPath, AppConfigReader.GetCombinedErrorLogPath() },

                { AppSettingsConstants.LogUpdateTimeInSec, AppConfigReader.GetLogUpdateTime() }
            };
        }
Пример #9
0
        private void GenerarNombresSP()
        {
            string esquema = AppConfigReader.Get("BaseDeDatos_Esquema");

            _sp_filtrar       = string.Format(AppConfigReader.Get("SP_Filtrar"), esquema, _nombreEntidad);
            _sp_obtener_todos = string.Format(AppConfigReader.Get("SP_Obtener_Todos"), esquema, _nombreEntidad);
        }
        private IWebDriver GetChromeDriver()
        {
            try
            {
                IWebDriver driver;
                var        options = SetChromeProperties();

                var config = new AppConfigReader();
                if (String.Compare(config.GetSeleniumHost(), "local", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), options);
                    driver.Navigate().GoToUrl(config.GetWebsite() + config.GetLoginPageEndpoint() + "?marketcode=" + config.GetMarket());
                    driver.Manage().Window.Maximize();
                    driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(100);
                    driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(50);
                    return(driver);
                }

                driver = new RemoteWebDriver(new Uri(config.GetSeleniumHost()),
                                             options);
                driver.Navigate().GoToUrl(config.GetWebsite() + config.GetLoginPageEndpoint() + "?marketcode=" + config.GetMarket());
                driver.Manage().Window.Maximize();
                driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(50);
                driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(50);
                return(driver);
            }
            catch (Exception e)
            {
                Console.WriteLine("Not able to create instance of webdriver in method - GetNgChromeDriver  --" + e.StackTrace + e.Message);
                throw e;
            }
        }
Пример #11
0
        private void Startup_OnStarting(object sender, Never.StartupEventArgs e)
        {
            var commandfile  = new FileInfo(AppContext.BaseDirectory + "\\App_Data\\command_demo.db");
            var eventfile    = new FileInfo(AppContext.BaseDirectory + "\\App_Data\\event_demo.db");
            var logfile      = new FileInfo(AppContext.BaseDirectory + "\\App_Config\\nlog.config");
            var configReader = new AppConfigReader(this.Configuration);

            DefaultSetting.DefaultDeserializeSetting = new JsonDeserializeSetting()
            {
                DateTimeFormat = DateTimeFormat.ChineseStyle
            };
            DefaultSetting.DefaultSerializeSetting = new JsonSerializeSetting()
            {
                DateTimeFormat = DateTimeFormat.ChineseStyle
            };

            e.Startup.RegisterAssemblyFilter("B2C".CreateAssemblyFilter()).RegisterAssemblyFilter("Never".CreateAssemblyFilter());
            e.Startup.UseEasyIoC(
                (x, y, z) =>
            {
                x.RegisterType <AuthenticationService, AuthenticationService>(string.Empty, ComponentLifeStyle.Singleton);
                x.RegisterType <ProxyRouteDispatcher, ProxyRouteDispatcher>(string.Empty, ComponentLifeStyle.Singleton);
                x.RegisterType <ProxyMiddlewear, ProxyMiddlewear>(string.Empty, ComponentLifeStyle.Singleton);
            },
                (x, y, z) =>
            {
            });

            e.Startup.UseConfigClient(new IPEndPoint(IPAddress.Parse(configReader["config_host"]), configReader.IntInAppConfig("config_port")), out var configFileClient);
            configFileClient.Startup(TimeSpan.FromMinutes(10), new[] { new ConfigFileClientRequest {
                                                                           FileName = "app_host"
                                                                       } }, (c, t) =>
            {
                var content = t;
                if (c != null && c.FileName == "app_host")
                {
                    System.IO.File.WriteAllText(System.IO.Path.Combine(this.Environment.ContentRootPath, "appsettings.app.json"), content);
                }
            }).Push("app_host").GetAwaiter().GetResult();

            e.Startup
            .UseCounterCache()
            .UseConcurrentCache()
            .UseNLog(logfile)
            .UseEasyJson(string.Empty)
            .UseApiModelStateValidation()
            .UseAppConfig(configReader)
            .UseApiActionCustomRoute(e.Collector as IServiceCollection)
            .UseApiDependency(e.Collector as IServiceCollection);

            //配置中心更新配置文件后,系统不一定马上能重新加载
            e.Startup.Startup(TimeSpan.FromSeconds(1), (x) =>
            {
                using (var sc = x.ServiceLocator.BeginLifetimeScope())
                {
                    var logger = sc.Resolve <ILoggerBuilder>().Build(typeof(Startup));
                    logger.Info("startup at " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                }
            });
        }
Пример #12
0
        public static void Initilize()
        {
            switch (AppConfigReader.GetBrowser())
            {
            case BrowserType.Chrome:
                Instance = new ChromeDriver();
                break;

            case BrowserType.Firefox:
                Instance = new FirefoxDriver();
                break;

            case BrowserType.IE:
                Instance = new InternetExplorerDriver();
                break;

            case BrowserType.PhantomJS:
                Instance = new PhantomJSDriver();
                break;

            default:
                throw new NoSuitableDriverFound("Driver not found:  " + AppConfigReader.GetBrowser().ToString());
            }
            //Instance.Manage().Window.Maximize();
        }
Пример #13
0
        private static void LoadAppSettingsItems()
        {
            var inputSource          = string.Empty;
            var selectedOperations   = new List <string>();
            var fileTypeToConvertPdf = string.Empty;

            AppWindow.Dispatcher?.Invoke(() =>
            {
                fileTypeToConvertPdf = InfoConstants.AllButPdf;
                inputSource          = AppWindow.ComboBoxInputSource.SelectedValue.ToString();
                selectedOperations   = FormControlHelper.ConvertToList(AppWindow.ListBoxRight.Items.SourceCollection,
                                                                       AppSettingsConstants.OperationTypesExecutionSequence);
            });

            AppSettingsItems = new Dictionary <string, object>
            {
                { AppSettingsConstants.Source, inputSource },
                { AppSettingsConstants.SelectedOperations, selectedOperations },
                { AppSettingsConstants.FileTypeForConvertToPdf, fileTypeToConvertPdf },

                { AppSettingsConstants.InputPath, AppConfigReader.GetInputPath() },
                { AppSettingsConstants.RootOutputPath, AppConfigReader.GetRootOutputPath() },
                { AppSettingsConstants.RootLogPath, AppConfigReader.GetRootLogPath() },
                { AppSettingsConstants.OutputPath, "" },
                { AppSettingsConstants.LogPath, "" },

                { AppSettingsConstants.EnableCombinedLogAndReport, AppConfigReader.EnableCombinedLogAndReport() },
                { AppSettingsConstants.CombinedOutputPath, AppConfigReader.GetCombinedOutputPath() },
                { AppSettingsConstants.CombinedSummaryLogPath, AppConfigReader.GetCombinedSummaryLogPath() },
                { AppSettingsConstants.CombinedErrorLogPath, AppConfigReader.GetCombinedErrorLogPath() },

                { AppSettingsConstants.LogUpdateTimeInSec, AppConfigReader.GetLogUpdateTime() }
            };
        }
Пример #14
0
        public void TestMethod1()
        {
            Iconfig config1 = new AppConfigReader();

            Console.WriteLine(config1.GetBrowser());
            Console.WriteLine(config1.GetPassword());
            Console.WriteLine(config1.GetUserName());
        }
        public void ReadingDataFromAppConfig_02()
        {
            IConfig config = new AppConfigReader();

            Console.WriteLine("Browser : {0}", config.GetBrowser());
            Console.WriteLine("Username : {0}", config.GetUsername());
            Console.WriteLine("Password : {0}", config.GetPassword());
        }
Пример #16
0
        public void TestMethod1()
        {
            IConfig config = new AppConfigReader();

            Console.WriteLine("Browser : {0}", config.GetBrowser());
            Console.WriteLine("Username : {0}", config.GetUsername());
            Console.WriteLine("Password : {0}", config.GetPassword());
        }
Пример #17
0
        public void ShouldReadConfiguration()
        {
            AppConfigReader sut = new AppConfigReader();

            sut.ReadConfiguration();

            Assert.IsNotNull(GlobalSettings.webSite);
        }
Пример #18
0
        public void TestMethod1()
        {
            IConfig config = new AppConfigReader();//check interface chapter for more details

            //IConfig config = new XmlReader();
            Console.WriteLine("Browser: {0}", config.GetBrowser());
            Console.WriteLine("UserName: {0}", config.GetUserName());
            Console.WriteLine("Password: {0}", config.GetPassword());
        }
Пример #19
0
        private void SetShowType()
        {
            string newEmrShowType = AppConfigReader.GetAppConfig("NewEmrShowType").Config; //1:按照病种分组  2:不进行分组

            if (newEmrShowType != "1")                                                     //不进行分组
            {
                colkIND.GroupIndex = -1;
                gridView1.OptionsView.ShowGroupPanel = false;
            }
        }
Пример #20
0
        protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);

            var config = AppConfigReader.RetrieveClientConfig();
            var client = new Domain.Client(config.Id, config.Name);

            container.Register(config);
            container.Register(client);
        }
Пример #21
0
        private void GenerarNombresSP()
        {
            string esquema = AppConfigReader.Get("BaseDeDatos_Esquema");

            _sp_obtener       = string.Format(AppConfigReader.Get("SP_Obtener"), esquema, _nombreEntidad);
            _sp_obtener_todos = string.Format(AppConfigReader.Get("SP_Obtener_Todos"), esquema, _nombreEntidad);
            _sp_borrar        = string.Format(AppConfigReader.Get("SP_Borrar"), esquema, _nombreEntidad);
            _sp_modificar     = string.Format(AppConfigReader.Get("SP_Actualizar"), esquema, _nombreEntidad);
            _sp_crear         = string.Format(AppConfigReader.Get("SP_Insertar"), esquema, _nombreEntidad);
            _sp_filtrar       = string.Format(AppConfigReader.Get("SP_Filtrar"), esquema, _nombreEntidad);
        }
 //Get the connection string from App.config file
 public DBUtils()
 {
     try
     {
         AppConfigReader appConfig = new AppConfigReader();
         connectionString = appConfig.GetDBConnectionString();
         Console.WriteLine("connection string=" + connectionString);
     }
     catch (Exception e)
     {
         Console.WriteLine("There was a problem while fetching connection string" + e);
     }
 }
Пример #23
0
        public void AssemblyInit()
        {
            string username = new AppConfigReader().GetUsername();
            string password = new AppConfigReader().GetPassword();

            Console.WriteLine("Initialising tests: ");
            string browser = "firefox";

            //string browser =  TestContext.DataRow["Browser"].ToString();
            BaseClass.InitWebdriver(browser);

            LoginPage.GoTo();
            LoginPage.LoginAs(username).WithPassword(password).Login();
        }
Пример #24
0
        public void LetsTestEC2()
        {
            string username = new AppConfigReader().GetUsername();
            string password = new AppConfigReader().GetPassword();


            //Console.WriteLine("Initialising Assembly: " + context.TestName);
            // new  SauceLabsBase().InitWebdriver();
            LoginPage.GoTo();
            LoginPage.LoginAs(username).WithPassword(password).Login();


            Assert.IsTrue(HomePage.IsAt, "Failed to login.");
        }
Пример #25
0
        static void Main(string[] args)
        {
            NancyClientHostHelper.Start(() =>
            {
                var config = AppConfigReader.RetrieveClientConfig();

                Console.WriteLine("Registering bot with server '{0}'...", config.ServerUrl);

                Console.WriteLine("... done.");

                Console.WriteLine("Bot started, press any key to exit...");
                Console.ReadKey();
            });
        }
Пример #26
0
        static Config()
        {
            var config = new AppConfigReader();

            var thumbprint = config.Get <string>("Security.Thumbprint");

            SecureConfig.Initialize(thumbprint);

            ConfluenceUsername = config.Get <string>("Confluence.Username");
            ConfluencePassword = SecureConfig.Decrypt(config.Get <string>("Confluence.Password"));

            CCNetUrl = config.Get <string>("CCNet.Url");
            NuGetUrl = config.Get <string>("NuGet.Url");
            TfsUrl   = config.Get <string>("Tfs.Url");
        }
Пример #27
0
        /// <summary>
        /// 针对护理的表单设置页数
        /// </summary>
        private void SetPageIndexForNurseRecord()
        {
            string AutoAddPage = AppConfigReader.GetAppConfig("AutoAddPageForNurseRecord").Config;

            if (AutoAddPage == "1")
            {
                string pageIndex = m_PatUtil.GetNurseRecordPageIndex(m_Model.InstanceId.ToString(), m_Model.TempIdentity, m_Model.ModelCatalog, m_noofinpat).ToString();
                if (pageIndex != "-1")
                {
                    CurrentForm.zyEditorControl1.EMRDoc.PageIndexForNurse = pageIndex;
                    CurrentForm.zyEditorControl1.EMRDoc.Refresh();
                    CurrentForm.zyEditorControl1.Refresh();
                }
            }
        }
Пример #28
0
        public void Sample()
        {
            //ConfigurationManager.AppSettings.Get("Browser");
            Console.WriteLine(ConfigurationManager.AppSettings.Get("Browser"));
            IConfig config = new AppConfigReader();

            //AppConfigReader appConfigReader = new AppConfigReader();
            Console.WriteLine("The browser is : {0}", config.GetBrowser());
            Console.WriteLine("The username is : {0}", config.GetUsername());
            Console.WriteLine("The password is : {0}", config.GetPassword());

            /*
             * config.GetBrowser();
             * config.GetUsername();
             * config.GetPassword();
             */
        }
Пример #29
0
        public static IApp StartApp(Platform platform)
        {
            // TODO: If the iOS or Android app being tested is included in the solution
            // then open the Unit Tests window, right click Test Apps, select Add App Project
            // and select the app projects that should be tested.
            //
            // The iOS project should have the Xamarin.TestCloud.Agent NuGet package
            // installed. To start the Test Cloud Agent the following code should be
            // added to the FinishedLaunching method of the AppDelegate:
            //

            //   #if ENABLE_TEST_CLOUD
            //   Xamarin.Calabash.Start();
            //   #endif

            AppConfigReader config = new AppConfigReader();

            string appBundle = config.GetAppPackage();

            if (platform == Platform.Android)
            {
                return(ConfigureApp
                       .Android
                       .EnableLocalScreenshots()
                       // TODO: Update this path to point to your Android app and uncomment the
                       // code if the app is not included in the solution.
                       //.ApkFile ("../../../Droid/bin/Debug/xamarinforms.apk")
                       .InstalledApp(appBundle)
                       .StartApp());
            }

            return(ConfigureApp
                   .iOS
                   .EnableLocalScreenshots()
                   // TODO: Update this path to point to your iOS app and uncomment the
                   // code if the app is not included in the solution.
                   //.AppBundle("../../../iOS/bin/iPhoneSimulator/Debug/XamarinForms.iOS.app")
                   // .AppBundle("/Users/shanoj/Desktop/EAXamarinApp.ipa")
                   //.DeviceIdentifier("4b07dfc8a642d8f9df1085139409668fde3244d5")
                   // .DeviceIdentifier("6E7FF663-C3C4-447B-A314-ECBA34CDF0F3")
                   .AppBundle("/Users/shanoj/Downloads/Xamarin.UITest-master/EAXamarinApp/EAXamarinApp.iOS/bin/iPhoneSimulator/Debug/device-builds/iphone10.4-12.1/EAXamarinApp.iOS.app")
                   //.AppBundle("/Users/shanoj/Downloads/Xamarin.UITest-master/EAXamarinApp/EAXamarinApp.iOS/bin/iPhone/Debug/device-builds/iphone10.2-12.1.4/EAXamarinApp.iOS.app")
                   // .InstalledApp(appBundle)
                   .StartApp());
        }
Пример #30
0
        public void LetsTestCloud()
        {
            string username = new AppConfigReader().GetUsername();
            string password = new AppConfigReader().GetPassword();

            List <string> browsers = new List <string>()
            {
                "firefox", "chome", "internet explorer"
            };
            string browser = "firefox";

            new SauceLabsBase("chrome").InitWebdriver();
            LoginPage.GoTo();
            LoginPage.LoginAs(username).WithPassword(password).Login();


            Assert.IsTrue(HomePage.IsAt, "Failed to login.");
        }