예제 #1
0
        private IReplEngineViewModel CreateViewModelAndStartEngine()
        {
            var errorStream = _replEngine.Error
                              .Select(x => new ReplLineViewModel(x, true))
                              .ObserveOn(_dispatcherScheduler);

            var outputStream = _replEngine.Output
                               .Select(x => new ReplLineViewModel(x))
                               .ObserveOn(_dispatcherScheduler);

            var stateStream = _replEngine.State
                              .ObserveOn(_dispatcherScheduler);

            IReplEngineViewModel viewModel = new ReplEngineViewModel(stateStream, outputStream, errorStream, _replEngine.WorkingDirectory, _processService);

            _disposable.Add(viewModel.Reset
                            .ObserveOn(_taskPoolScheduler)
                            .Subscribe(_ => _replEngine.Reset()));

            _disposable.Add(viewModel.Execute
                            .ObserveOn(_taskPoolScheduler)
                            .Subscribe(x => _replEngine.Execute(x)));

            _replEngine.Start(_startupScript);

            return(viewModel);
        }
        public void SetUp()
        {
            _stateSubject = new Subject<State>();
            _replOutputSubject = new Subject<ReplLineViewModel>();
            _replErrorSubject = new Subject<ReplLineViewModel>();
            _workingDirectory = @"c:\temp\fhsarp";

            _process = new Mock<IProcess>();
            _processService = new Mock<IProcessService>(MockBehavior.Strict);
            
            _scheduler = new TestScheduler();

            _viewModel = new ReplEngineViewModel(_stateSubject, _replOutputSubject, _replErrorSubject, _workingDirectory, _processService.Object);
        }
        public void SetUp()
        {
            _stateSubject      = new Subject <State>();
            _replOutputSubject = new Subject <ReplLineViewModel>();
            _replErrorSubject  = new Subject <ReplLineViewModel>();
            _workingDirectory  = @"c:\temp\fhsarp";

            _process        = new Mock <IProcess>();
            _processService = new Mock <IProcessService>(MockBehavior.Strict);

            _scheduler = new TestScheduler();

            _viewModel = new ReplEngineViewModel(_stateSubject, _replOutputSubject, _replErrorSubject, _workingDirectory, _processService.Object);
        }
        private IReplEngineViewModel CreateViewModelAndStartEngine()
        {
            var errorStream = _replEngine.Error
                        .Select(x => new ReplLineViewModel(x, true))
                        .ObserveOn(_dispatcherScheduler);

            var outputStream = _replEngine.Output
                        .Select(x => new ReplLineViewModel(x))
                        .ObserveOn(_dispatcherScheduler);

            var stateStream = _replEngine.State
                       .ObserveOn(_dispatcherScheduler);

            IReplEngineViewModel viewModel = new ReplEngineViewModel(stateStream, outputStream, errorStream, _replEngine.WorkingDirectory, _processService);

            _disposable.Add(viewModel.Reset
               .ObserveOn(_taskPoolScheduler)
               .Subscribe(_ => _replEngine.Reset()));

            _disposable.Add(viewModel.Execute
               .ObserveOn(_taskPoolScheduler)
               .Subscribe(x => _replEngine.Execute(x)));

            _replEngine.Start(_startupScript);

            return viewModel;
        }