Пример #1
0
        public async Task VerifyThatHideProductTreeWorks()
        {
            this.ribbonPart = new ProductTreeRibbonPart(this.order, this.panelNavigationService.Object, this.positiveDialogNavigationService.Object, null, null);

            var fluentRibbonManager = new FluentRibbonManager();

            fluentRibbonManager.IsActive = true;
            fluentRibbonManager.RegisterRibbonPart(this.ribbonPart);

            var openSessionEvent = new SessionEvent(this.session.Object, SessionStatus.Open);

            CDPMessageBus.Current.SendMessage(openSessionEvent);

            CDPMessageBus.Current.SendObjectChangeEvent(this.iteration, EventKind.Added);
            Assert.AreEqual(1, this.ribbonPart.Iterations.Count);

            var content = this.ribbonPart.GetContent("ShowProductTree_");

            await this.ribbonPart.OnAction($"ShowProductTree_{this.iteration.Iid}_{this.option1.Iid}", $"{this.iteration.Iid}_{this.option1.Iid}");

            this.panelNavigationService.Verify(x => x.OpenInAddIn(It.IsAny <IPanelViewModel>()));

            var allBrowsers = this.ribbonPart.GetAllOpenBrowsers();

            CDPMessageBus.Current.SendMessage(new HidePanelEvent(allBrowsers.SelectMany(x => x).First().Identifier));

            this.panelNavigationService.Verify(x => x.CloseInAddIn(It.IsAny <IPanelViewModel>()), Times.Once);

            CollectionAssert.IsEmpty(this.ribbonPart.GetAllOpenBrowsers().SelectMany(x => x));
        }
Пример #2
0
        public async Task VerifyThatOnActionProductTreeWorks()
        {
            this.ribbonPart = new ProductTreeRibbonPart(this.order, this.panelNavigationService.Object, this.positiveDialogNavigationService.Object, null, null);

            var fluentRibbonManager = new FluentRibbonManager();

            fluentRibbonManager.IsActive = true;
            fluentRibbonManager.RegisterRibbonPart(this.ribbonPart);

            var openSessionEvent = new SessionEvent(this.session.Object, SessionStatus.Open);

            CDPMessageBus.Current.SendMessage(openSessionEvent);

            CDPMessageBus.Current.SendObjectChangeEvent(this.iteration, EventKind.Added);
            Assert.AreEqual(1, this.ribbonPart.Iterations.Count);

            var content = this.ribbonPart.GetContent("ShowProductTree_");

            await this.ribbonPart.OnAction($"ShowProductTree_{this.iteration.Iid}_{this.option1.Iid}", $"{this.iteration.Iid}_{this.option1.Iid}");

            this.panelNavigationService.Verify(x => x.OpenInAddIn(It.IsAny <IPanelViewModel>()));

            CDPMessageBus.Current.SendObjectChangeEvent(this.iteration, EventKind.Removed);
            Assert.AreEqual(0, this.ribbonPart.Iterations.Count);
        }
Пример #3
0
        public void VerifyThatButtonsAreEnabledAsExpected()
        {
            this.ribbonPart = new ProductTreeRibbonPart(this.order, this.panelNavigationService.Object, this.negativeDialogNavigationService.Object, null, null);

            var fluentRibbonManager = new FluentRibbonManager();

            fluentRibbonManager.IsActive = true;
            fluentRibbonManager.RegisterRibbonPart(this.ribbonPart);

            Assert.IsFalse(this.ribbonPart.GetEnabled("ShowProductTree_"));

            var openSessionEvent = new SessionEvent(this.session.Object, SessionStatus.Open);

            CDPMessageBus.Current.SendMessage(openSessionEvent);

            Assert.IsFalse(this.ribbonPart.GetEnabled("ShowProductTree_"));

            CDPMessageBus.Current.SendObjectChangeEvent(this.iteration, EventKind.Added);
            Assert.AreEqual(1, this.ribbonPart.Iterations.Count);

            Assert.IsTrue(this.ribbonPart.GetEnabled("ShowProductTree_"));

            CDPMessageBus.Current.SendObjectChangeEvent(this.iteration, EventKind.Removed);
            Assert.AreEqual(0, this.ribbonPart.Iterations.Count);

            Assert.IsFalse(this.ribbonPart.GetEnabled("ShowProductTree_"));

            var closeSessionEvent = new SessionEvent(this.session.Object, SessionStatus.Closed);

            CDPMessageBus.Current.SendMessage(closeSessionEvent);

            Assert.IsFalse(this.ribbonPart.GetEnabled("ShowProductTree_"));
        }
Пример #4
0
        public void VerifyThatIfFluentRibbonIsNullTheSessionEventHasNoEffect()
        {
            this.ribbonPart = new ProductTreeRibbonPart(this.order, this.panelNavigationService.Object, this.negativeDialogNavigationService.Object, null, null);

            var sessionEvent = new SessionEvent(this.session.Object, SessionStatus.Open);

            CDPMessageBus.Current.SendMessage(sessionEvent);
            Assert.IsNull(this.ribbonPart.Session);
        }
Пример #5
0
        public void VerifyThatRibbonPartHandlesSessionOpenAndCloseEvent()
        {
            this.ribbonPart = new ProductTreeRibbonPart(this.order, this.panelNavigationService.Object, this.negativeDialogNavigationService.Object, null, null);

            var fluentRibbonManager = new FluentRibbonManager();

            fluentRibbonManager.IsActive = true;
            fluentRibbonManager.RegisterRibbonPart(this.ribbonPart);

            var openSessionEvent = new SessionEvent(this.session.Object, SessionStatus.Open);

            CDPMessageBus.Current.SendMessage(openSessionEvent);

            Assert.AreEqual(this.session.Object, this.ribbonPart.Session);

            var closeSessionEvent = new SessionEvent(this.session.Object, SessionStatus.Closed);

            CDPMessageBus.Current.SendMessage(closeSessionEvent);

            Assert.IsNull(this.ribbonPart.Session);
        }