Exemplo n.º 1
0
        public void VerifyThatCommandsCallNavigationService()
        {
            var ribbon1 = new CategoryRibbonViewModel();
            var ribbon2 = new MeasurementScalesRibbonViewModel();
            var ribbon3 = new MeasurementUnitsRibbonViewModel();
            var ribbon4 = new RulesRibbonViewModel();
            var ribbon5 = new ParameterTypeRibbonViewModel();

            CDPMessageBus.Current.SendMessage(new SessionEvent(this.session.Object, SessionStatus.Open));

            ribbon1.OpenSingleBrowserCommand.Execute(null);
            ribbon2.OpenSingleBrowserCommand.Execute(null);
            ribbon3.OpenSingleBrowserCommand.Execute(null);
            ribbon4.OpenSingleBrowserCommand.Execute(null);
            ribbon5.OpenSingleBrowserCommand.Execute(null);

            this.navigation.Verify(x => x.Open(It.IsAny <IPanelViewModel>(), true), Times.Exactly(5));

            ribbon1.OpenSingleBrowserCommand.Execute(null);
            ribbon2.OpenSingleBrowserCommand.Execute(null);
            ribbon3.OpenSingleBrowserCommand.Execute(null);
            ribbon4.OpenSingleBrowserCommand.Execute(null);
            ribbon5.OpenSingleBrowserCommand.Execute(null);

            this.navigation.Verify(x => x.Close(It.IsAny <IPanelViewModel>(), true), Times.Exactly(5));
        }
Exemplo n.º 2
0
        public void Verify_That_InstantiatePanelViewModel_Returns_Expected_ViewModel()
        {
            var viewmodel = CategoryRibbonViewModel.InstantiatePanelViewModel(
                this.session.Object,
                this.thingDialogNavigationService.Object,
                this.panelNavigationService.Object,
                this.dialogNavigationService.Object,
                this.pluginSettingsService.Object);

            Assert.IsInstanceOf <CategoryBrowserViewModel>(viewmodel);
        }
Exemplo n.º 3
0
        public void VerifyThatCommandDontDoAnythingWithoutOpenSession()
        {
            var ribbon1 = new CategoryRibbonViewModel();
            var ribbon2 = new MeasurementScalesRibbonViewModel();
            var ribbon3 = new MeasurementUnitsRibbonViewModel();
            var ribbon4 = new RulesRibbonViewModel();
            var ribbon5 = new ParameterTypeRibbonViewModel();

            ribbon1.OpenSingleBrowserCommand.Execute(null);
            ribbon2.OpenSingleBrowserCommand.Execute(null);
            ribbon3.OpenSingleBrowserCommand.Execute(null);
            ribbon4.OpenSingleBrowserCommand.Execute(null);
            ribbon5.OpenSingleBrowserCommand.Execute(null);

            this.navigation.Verify(x => x.Open(It.IsAny <IPanelViewModel>(), true), Times.Never());
            this.navigation.Verify(x => x.Close(It.IsAny <IPanelViewModel>(), true), Times.Never());
        }
Exemplo n.º 4
0
        public void VerifyThatCloseSessionEventAreCaught()
        {
            var ribbon1 = new CategoryRibbonViewModel();
            var ribbon2 = new MeasurementScalesRibbonViewModel();
            var ribbon3 = new MeasurementUnitsRibbonViewModel();
            var ribbon4 = new RulesRibbonViewModel();
            var ribbon5 = new ParameterTypeRibbonViewModel();

            CDPMessageBus.Current.SendMessage(new SessionEvent(this.session.Object, SessionStatus.Open));
            CDPMessageBus.Current.SendMessage(new SessionEvent(this.session.Object, SessionStatus.Closed));

            Assert.AreEqual(0, ribbon1.OpenSessions.Count);
            Assert.AreEqual(0, ribbon2.OpenSessions.Count);
            Assert.AreEqual(0, ribbon3.OpenSessions.Count);
            Assert.AreEqual(0, ribbon4.OpenSessions.Count);
            Assert.AreEqual(0, ribbon5.OpenSessions.Count);
        }