private void LoadGameToBeMonitored(string fileNameAndPath, PollWatcherFactory pollWatcherFactory)
 {
     GameName = Path.GetFileNameWithoutExtension(fileNameAndPath);
     logger.Info(string.Format("Monitoring process [{0}]", GameName));
     var watchingGame = pollWatcherFactory.CreateNewPollWatcher(GameName);
     watchingGame.ElapsedTimeTick += () => { ElapsedTime = watchingGame.ElapsedTime; };
 }
        public GameMonitorDisplayViewModel(ISynchronizeInvoke synchronizeInvoke, string fileNameAndPath, PollWatcherFactory pollWatcherFactory, Func<Type, ILog> loggerFactory)
        {
            this.synchronizeInvoke = synchronizeInvoke;
            logger = loggerFactory(typeof(GameMonitorDisplayViewModel));

            LoadGameToBeMonitored(fileNameAndPath, pollWatcherFactory);
        }
        private GameMonitorDisplayFactory CreateUnit(GameModelDisplayViewModelFactory gameMonitorDisplayViewModelFactory = null, Func<Type, ILog> loggerFactory = null)
        {
            if (loggerFactory == null)
                loggerFactory = type => new Mock<ILog>().Object;

            if (gameMonitorDisplayViewModelFactory == null)
            {
                var pollWatcherFactory = new PollWatcherFactory(loggerFactory);
                gameMonitorDisplayViewModelFactory = new GameModelDisplayViewModelFactory(pollWatcherFactory, loggerFactory);
            }

            return new GameMonitorDisplayFactory(gameMonitorDisplayViewModelFactory, loggerFactory);
        }
        private GameMonitorDisplayViewModel CreateGameMonitorDisplayViewModel(ISynchronizeInvoke synchronizeInvoke = null, string processName = null, PollWatcherFactory pollWatcherFactory = null, Func<Type, ILog> loggerFactory = null)
        {
            if (synchronizeInvoke == null)
                synchronizeInvoke = new Mock<ISynchronizeInvoke>().Object;

            if (processName == null)
                processName = "notepad.exe";

            if (loggerFactory == null)
                loggerFactory = type => new Mock<ILog>().Object;

            if (pollWatcherFactory == null)
                pollWatcherFactory = new PollWatcherFactory(loggerFactory);

            return new GameMonitorDisplayViewModel(synchronizeInvoke, processName, pollWatcherFactory, loggerFactory);
        }
 public GameModelDisplayViewModelFactory(PollWatcherFactory pollWatcherFactory, Func<Type, ILog> loggerFactory)
 {
     this.loggerFactory = loggerFactory;
     this.pollWatcherFactory = pollWatcherFactory;
 }