예제 #1
0
        public void 終了を示す文字列を判定できる_終了文字以外()
        {
            // Arrange
            var sut = new ExitPhaseValidator();

            // Act
            // Assert
            Assert.IsFalse(sut.Validate("dummy"));
        }
예제 #2
0
        public void 終了を示す文字列を判定できる_大文字()
        {
            // Arrange
            var sut = new ExitPhaseValidator();

            // Act
            // Assert
            Assert.IsTrue(sut.Validate("EXIT"));
        }
예제 #3
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();
            }
        }