Пример #1
0
        public void Execute_LimitationCanExecute_Executed()
        {
            // Arrange
            bool executed = false;

            mockLimitationService.Setup(lim => lim.CanExecute(limitationName)).Returns(true);
            var command = new LimitationCommand(limitationName, () => { executed = true; });

            // Act
            command.Execute();

            // Assert
            Assert.IsTrue(executed);
            mockLimitationService.Verify(lim => lim.MoveToUpgradeDialog(limitationName), Times.Never);
        }
Пример #2
0
        public void Execute_LimitationNotInitialized_Executed()
        {
            // Arrange
            bool executed = false;

            App.Current.LicenseLimitationsService = new LicenseLimitationsService();
            var command = new LimitationCommand(limitationName, () => { executed = true; });

            // Act
            command.Execute();

            // Assert
            Assert.IsTrue(executed);
            Assert.AreEqual(executed, command.Executed);
        }
Пример #3
0
        public void Execute_LimitationCanNotExecute_MoveToUpgradeDialog()
        {
            // Arrange
            bool executed = false;

            mockLimitationService.Setup(lim => lim.CanExecute(limitationName)).Returns(false);
            var command = new LimitationCommand(limitationName, () => { executed = true; });

            // Act
            command.Execute();

            // assert
            Assert.IsFalse(executed);
            Assert.AreEqual(executed, command.Executed);
            mockLimitationService.Verify(lim => lim.MoveToUpgradeDialog(limitationName), Times.Once);
        }
Пример #4
0
        public void Execute_FeatureCanExecuteButConditionSetToNotApplyLimit_ExecuteOk()
        {
            // Arrange
            bool executed = false;

            mockLimitationService.Setup(lim => lim.CanExecute(limitationName)).Returns(false);
            var command = new LimitationCommand(limitationName, () => { executed = true; });

            command.LimitationCondition = () => false;

            // Act
            command.Execute();

            // assert
            Assert.IsTrue(executed);
            mockLimitationService.Verify(lim => lim.MoveToUpgradeDialog(limitationName), Times.Never);
        }
Пример #5
0
        void HandleProjectTypeSet(object sender, EventArgs e)
        {
            if (sender == filebutton)
            {
                projectType = ProjectType.FileProject;
            }
            else if (sender == capturebutton)
            {
                if (videoDevices == null || videoDevices.Count == 0)
                {
                    FillDevices(mtoolkit.VideoDevices);
                }

                if (videoDevices == null || videoDevices.Count == 0)
                {
                    App.Current.Dialogs.ErrorMessage(Catalog.GetString("No capture devices found in the system"),
                                                     this);
                    return;
                }
                projectType = ProjectType.CaptureProject;
            }
            else if (sender == fakebutton)
            {
                projectType = ProjectType.FakeCaptureProject;
            }
            else if (sender == ipbutton)
            {
                projectType = ProjectType.URICaptureProject;
            }
            if (projectType == ProjectType.URICaptureProject)
            {
                ipCameraCommand.Execute();
            }
            else
            {
                HandleNextClicked(this, e);
            }
        }
Пример #6
0
 private void ConnectMenuSignals()
 {
     CategoriesTemplatesManagerAction.Activated += (o, e) => {
         App.Current.StateController.MoveTo(DashboardsManagerState.NAME, null, true);
     };
     TeamsTemplatesManagerAction.Activated += (o, e) => {
         App.Current.StateController.MoveTo(TeamsManagerState.NAME, null, true);
     };
     ProjectsManagerAction.Activated += (o, e) => {
         App.Current.StateController.MoveTo(ProjectsManagerState.NAME, null, true);
     };
     //FIXME: this should be done by binding the LimitationCommand to the MenuItem
     DatabasesManagerAction.Activated += (o, e) => {
         DatabaseManagerCommand.Execute();
     };
     PreferencesAction.Activated += (sender, e) => {
         App.Current.StateController.MoveTo(PreferencesState.NAME, null);
     };
     QuitAction.Activated += (o, e) => {
         App.Current.GUIToolkit.Quit();
     };
     OpenProjectAction.Activated += (sender, e) => {
         App.Current.StateController.MoveTo(OpenProjectState.NAME, null, true);
     };
     NewPojectAction.Activated += (sender, e) => {
         App.Current.StateController.MoveTo(NewProjectState.NAME, null, true);
     };
     ImportProjectAction.Activated += (sender, e) => {
         App.Current.EventsBroker.Publish <ImportProjectEvent> (new ImportProjectEvent());
     };
     FullScreenAction.Activated += (object sender, EventArgs e) => {
         App.Current.EventsBroker.Publish <ShowFullScreenEvent> (
             new ShowFullScreenEvent {
             Active = FullScreenAction.Active
         }
             );
     };
 }