示例#1
0
        private void MenuRunCallback(object sender, EventArgs e)
        {
            string result = String.Empty;

            try
            {
                result = _runAction.Execute();
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            SetStatusBarText(result);
        }
        public void Execute_calls_new_process()
        {
            string expectedTool = "Tool1";
            string inputArgs    = "Arg1 Arg2";
            string expectedArgs = "ABC DEF";

            var runctx = new RunContext()
            {
                Config = new RunConfig()
                {
                    RunTool = expectedTool,
                    RunArgs = inputArgs,
                },
                ConnectionString = new SqlConnectionStringBuilder()
                {
                    DataSource         = "127.0.0.1",
                    InitialCatalog     = "MYDATABASE",
                    UserID             = "user1",
                    Password           = "******",
                    IntegratedSecurity = false
                },
            };

            IRunContextProvider contextProvider = A.Fake <IRunContextProvider>();

            A.CallTo(() => contextProvider.Get()).Returns(runctx);

            IRunParamsProcessor paramsProcessor = A.Fake <IRunParamsProcessor>();

            A.CallTo(() => paramsProcessor.Compose(inputArgs, runctx.ConnectionString)).Returns(expectedArgs);

            IRunProcessStarter processStarter = A.Fake <IRunProcessStarter>();

            RunAction runAction = new RunAction(contextProvider, paramsProcessor, processStarter);

            runAction.Execute();

            A.CallTo(() => processStarter.Start(expectedTool, expectedArgs)).MustHaveHappenedOnceExactly();
        }
示例#3
0
 public string Execute()
 {
     return(_runAction.Execute());
 }