public static void Main()
        {
            IInputHandler consoleHandler = new ConsoleInputHandler();
            IRenderer consoleRenderer = new ConsoleRenderer();
            BookStoreEngine engine = new BookStoreEngine(consoleRenderer, consoleHandler);

            engine.Run();
        }
Example #2
0
        public static void Main()
        {
            IInputHandler inputHandler = new ConsoleInputHandler();
            var renderer = new ConsoleRenderer();
            BookStoreEngine engine = new BookStoreEngine(renderer,inputHandler);

            engine.Run();
        }
Example #3
0
        public static void Main()
        {
            IInputHandler   inputHandler = new ConsoleInputHandler();
            var             renderer     = new ConsoleRenderer();
            BookStoreEngine engine       = new BookStoreEngine(renderer, inputHandler);

            engine.Run();
        }
Example #4
0
        /// <summary>
        /// Main method for the game
        /// </summary>
        public static void Main()
        {
            IRenderer consoleRenderer = new ConsoleRenderer();
            IInputHandler inputHandler = new ConsoleInputHandler();
            IBattlefieldGameEngine engine = new BattlefieldGameEngine(consoleRenderer, inputHandler);

            engine.Run();
        }
Example #5
0
        public static void Main(string[] args)
        {
            var outputHandler = new ConsoleOutputHandler();
            var inputHandler  = new ConsoleInputHandler(outputHandler);

            var game = new Game(outputHandler, inputHandler);

            game.Run();
        }
Example #6
0
        public static void Main()
        {
            ConsoleInputHandler cih = new ConsoleInputHandler();
            ConsoleRenderer cr = new ConsoleRenderer();

            BookStoreEngine engine = new BookStoreEngine(cr, cih);

            engine.Run();
        }
Example #7
0
        public static void Main()
        {
            ConsoleRenderer     consoleRenderer = new ConsoleRenderer();
            ConsoleInputHandler inputHandler    = new ConsoleInputHandler();

            BookStoreEngine engine = new BookStoreEngine(inputHandler, consoleRenderer);

            engine.Run();
        }
Example #8
0
        public static void Main()
        {
            IRankList       gameRankList   = new RankList();
            ICommandFactory commandFactory = new CommandFactory();
            IRenderer       renderer       = new ConsoleRenderer();
            IInputHandler   inputHandler   = new ConsoleInputHandler();
            IGameEngine     gameEngine     = new GameEngine(gameRankList, commandFactory, inputHandler, renderer);

            gameEngine.Run();
        }
        public static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            IInputHandler inputHandler = new ConsoleInputHandler();
            IRenderer     renderer     = new FileRenderer();

            BookStoreEngine engine = new BookStoreEngine(renderer, inputHandler);

            engine.Run();
        }
Example #10
0
        public static void Main()
        {
            IRenderer renderer = new ConsoleRenderer();
            IInputHandler inputHandler = new ConsoleInputHandler();
            IPlayer player = new Player();
            SeedInitialPlayerInventory(player);

            IGameEngine engine = new GameEngine(renderer, inputHandler, player);

            engine.Run();
        }
Example #11
0
        public override void Run()
        {
            var listener = new ConsoleInputHandler();

            listener.MouseMoved         += OnMouseMoved;
            listener.MouseDoubleClicked += OnMouseDoubleClicked;
            listener.MouseWheelChanged  += OnMouseWheelChanged;
            listener.KeyDown            += OnKeyDown;
            listener.Start();
            listener.Wait();
        }
Example #12
0
        public static void Main()
        {
            IRenderer     renderer     = new ConsoleRenderer();
            IInputHandler inputHandler = new ConsoleInputHandler();
            IPlayer       player       = new Player();

            SeedInitialPlayerInventory(player);

            IGameEngine engine = new GameEngine(renderer, inputHandler, player);

            engine.Run();
        }
Example #13
0
        public static void Main()
        {
            Character      player         = new Character(new Position(0, 0), 'C', ConsoleColor.Yellow, 0, 0, 0, 0, CharacterRace.Ashe);
            IRenderer      renderer       = new ConsoleRenderer();
            IInputHandler  inputHandler   = new ConsoleInputHandler();
            IController    controller     = new KeyboardController();
            CommandFactory commandFactory = new CommandFactory();
            GameEngine     gameEngine     = new GameEngine(player, renderer, inputHandler, controller, commandFactory);

            Console.CursorVisible = false;

            gameEngine.Run();
        }
        public void When_DomainArgumentIsProvided_Then_GetOnlyDomainDataFromUri()
        {
            // Arrange
            var args      = new string[] { "http://www.google.com/about" };
            var clockMock = new Mock <IClock>();
            var target    = new ConsoleInputHandler(clockMock.Object);

            // Act
            target.ReadArguments(args);

            //Assert
            Assert.AreEqual("http://www.google.com/", target.DomainUri.AbsoluteUri);
        }
        public void When_MoreArgumentsProvided_Then_ReturnArgumentValuesAndIgnoreTheRest()
        {
            // Arrange
            var args      = new string[] { "http://www.google.com/", "C:/crawler.txt", "false" };
            var clockMock = new Mock <IClock>();
            var target    = new ConsoleInputHandler(clockMock.Object);

            // Act
            target.ReadArguments(args);

            //Assert
            Assert.AreEqual("http://www.google.com/", target.DomainUri.AbsoluteUri);
            Assert.AreEqual("C:/crawler.txt", target.OutputFilePath);
            Assert.AreEqual("False", target.WaitBeforeEnd.ToString());
        }
        public void When_OutputFilePathArgumentIsProvided_Then_ReturnFormattedValue()
        {
            // Arrange
            var args      = new string[] { "http://www.google.com", "C:/crawler_{0:yyyyMMdd}.txt" };
            var clockMock = new Mock <IClock>();

            clockMock.Setup(m => m.Now).Returns(new DateTime(2018, 9, 24));
            var target = new ConsoleInputHandler(clockMock.Object);

            // Act
            target.ReadArguments(args);

            //Assert
            Assert.AreEqual("C:/crawler_20180924.txt", target.OutputFilePath);
        }
        public void When_SomeArgumentsProvided_Then_ReturnArgumentValuesAndDefaultValues()
        {
            // Arrange
            var args        = new string[] { "http://www.google.com/" };
            var dateTimeNow = new DateTime(2018, 9, 24, 1, 1, 1);
            var clockMock   = new Mock <IClock>();

            clockMock.Setup(m => m.Now).Returns(dateTimeNow);
            var target = new ConsoleInputHandler(clockMock.Object);

            // Act
            target.ReadArguments(args);

            //Assert
            var expectedOutputFilePath = string.Format(ConsoleInputHandler.DefaultOutputFilePathFormat, dateTimeNow);

            Assert.AreEqual("http://www.google.com/", target.DomainUri.AbsoluteUri);
            Assert.AreEqual(expectedOutputFilePath, target.OutputFilePath);
            Assert.AreEqual(ConsoleInputHandler.DefaultWaitBeforeEnd, target.WaitBeforeEnd.ToString());
        }
Example #18
0
 internal ConsoleMenuInputHandler()
 {
     handler = new ConsoleInputHandler();
 }
Example #19
0
 public static void AddListener(ConsoleInputHandler eh)
 {
     listeners += eh;
 }
Example #20
0
 public static void RemoveListener(ConsoleInputHandler eh)
 {
     listeners -= eh;
 }