Example #1
0
        public MouserApplicationContext()
        {
            _container = Bootstrap();

            _logger             = _container.GetInstance <ILogger>();
            _mouser             = _container.GetInstance <Mouser>();
            _settingsRepository = _container.GetInstance <ISettingsRepository>();

            var formMain = _container.GetInstance <FormMain>();

            formMain.Closed += (sender, args) => Exit();

            _formMainViewModel = new FormMainViewModel(formMain)
            {
                Settings = _settingsRepository.Load()
            };
            _formMainViewModel.MouserSignalSent += FormMainViewModelOnMouserSignalSent;
            _formMainViewModel.ShowView();
        }
Example #2
0
        public void PerformMouseAction_AllActions_CallsCorrectMouseWrapperMethod(Mouser.Mouser.MouseActions mouseAction,
                                                                                 Dictionary <Expression <Action <IMouseWrapper> >, Times> expectedMouseWrapperActions)
        {
            var mockKeyboardCapturer = new Mock <IKeyboardCapturer>();
            var mockMouseWrapper     = new Mock <IMouseWrapper>();

            var settings = new MouserSettings
            {
                FixedMovePixels = 1,
                MoveMode        = MouserSettings.MoveModes.FixedSpeed
            };

            var mouser = new Mouser.Mouser(mockMouseWrapper.Object, mockKeyboardCapturer.Object, new TestLogger());

            mouser.SetSettings(settings);

            mouser.PerformMouseAction(mouseAction);

            foreach (var kvp in expectedMouseWrapperActions)
            {
                mockMouseWrapper.Verify(kvp.Key, kvp.Value);
            }
        }