예제 #1
0
        public void Execute_Nullを渡した場合例外が発生することを確認()
        {
            // Arrange
            var target = new CuiAppProcessExecutor();

            // Act
            target.Execute(null);

            // Assert
            Assert.Fail("例外が発生していない");
        }
예제 #2
0
파일: Program.cs 프로젝트: cj-jeon/Sazare
        static void Main()
        {
            try
            {
                Input.InputManager   = new CuiInputManager();
                Output.OutputManager = new CuiOutputManager();

                var emptyValidator = new EmptyInputValidator();
                var exitValidator  = new ExitPhaseValidator();

                for (;;)
                {
                    try
                    {
                        Output.Write("\nENTER CLASS NAME: ");

                        var userInput = Input.ReadLine().ToString();
                        if (emptyValidator.Validate(userInput))
                        {
                            continue;
                        }

                        if (exitValidator.Validate(userInput))
                        {
                            break;
                        }

                        var handle = Activator.CreateInstance(GetAssembly().FullName, GetFqdnName(userInput));
                        if (handle != null)
                        {
                            var clazz = handle.Unwrap();
                            if (clazz != null)
                            {
                                var executor = new CuiAppProcessExecutor();
                                executor.Execute(clazz as IExecutable);
                            }
                        }
                    }
                    catch (TypeLoadException)
                    {
                        Output.WriteLine("指定されたサンプルが見つかりません...[{0}]", ClassName);
                    }
                    catch (Exception ex)
                    {
                        Output.WriteLine(ex.ToString());
                    }
                }
            }
            finally
            {
                Output.WriteLine("\n\nPress any key to exit...");
                Input.Read();
            }
        }
예제 #3
0
        public void Execute_Nullを渡した場合例外が発生することを確認()
        {
            // Arrange
              var target = new CuiAppProcessExecutor();

              // Act
              target.Execute(null);

              // Assert
              Assert.Fail("例外が発生していない");
        }
예제 #4
0
        public void Execute_引数で指定されたIExecutableのExecuteメソッドが呼ばれることを確認()
        {
            // Arrange
            var executable = new ExecutableForUnitTest();
            var target     = new CuiAppProcessExecutor();

            // Act
            target.Execute(executable);

            // Assert
            Assert.IsTrue(executable.ExecuteCalled);
        }
예제 #5
0
        public void Execute_引数で指定されたIExecutableのExecuteメソッドが呼ばれることを確認()
        {
            // Arrange
              var executable = new ExecutableForUnitTest();
              var target     = new CuiAppProcessExecutor();

              // Act
              target.Execute(executable);

              // Assert
              Assert.IsTrue(executable.ExecuteCalled);
        }
예제 #6
0
        public void Execute_Executableの実行前と実行後にSTARTとENDログが出力されることを確認()
        {
            // Arrange
              var outputManager = new FirstLastRememberOutputManager();
              Output.OutputManager = outputManager;

              var executable = new ExecutableForUnitTest();
              var target = new CuiAppProcessExecutor();

              // Act
              target.Execute(executable);

              // Assert
              Assert.AreEqual<string>(target.StartLogMessage, outputManager.First.ToString());
              Assert.AreEqual<string>(target.EndLogMessage, outputManager.Last.ToString());
        }
예제 #7
0
        public void Execute_Executableの実行前と実行後にSTARTとENDログが出力されることを確認()
        {
            // Arrange
            var outputManager = new FirstLastRememberOutputManager();

            Output.OutputManager = outputManager;

            var executable = new ExecutableForUnitTest();
            var target     = new CuiAppProcessExecutor();

            // Act
            target.Execute(executable);

            // Assert
            Assert.AreEqual <string>(target.StartLogMessage, outputManager.First.ToString());
            Assert.AreEqual <string>(target.EndLogMessage, outputManager.Last.ToString());
        }
예제 #8
0
파일: Program.cs 프로젝트: devlights/Sazare
        static void Main()
        {
            try
              {
            Input.InputManager   = new CuiInputManager();
            Output.OutputManager = new CuiOutputManager();

            var emptyValidator = new EmptyInputValidator();
            var exitValidator  = new ExitPhaseValidator();

            for (;;)
            {
              try
              {
            Output.Write("\nENTER CLASS NAME: ");

            var userInput = Input.ReadLine().ToString();
            if (emptyValidator.Validate(userInput))
            {
              continue;
            }

            if (exitValidator.Validate(userInput))
            {
              break;
            }

            var handle = Activator.CreateInstance(GetAssembly().FullName, GetFqdnName(userInput));
            if (handle != null)
            {
              var clazz = handle.Unwrap();
              if (clazz != null)
              {
                var executor = new CuiAppProcessExecutor();
                executor.Execute(clazz as IExecutable);
              }
            }
              }
              catch (TypeLoadException)
              {
            Output.WriteLine("指定されたサンプルが見つかりません...[{0}]", ClassName);
              }
              catch (Exception ex)
              {
            Output.WriteLine(ex.ToString());
              }
            }
              }
              finally
              {
            Output.WriteLine("\n\nPress any key to exit...");
            Input.Read();
              }
        }