コード例 #1
0
        public void VerifyThatNewRolesAreAdded()
        {
            var viewmodel          = new RoleBrowserViewModel(this.session.Object, this.siteDir, null, this.navigation.Object, null, null);
            var newPersonRole      = new PersonRole(Guid.NewGuid(), null, this.uri);
            var newParticipantRole = new ParticipantRole(Guid.NewGuid(), null, this.uri);

            this.siteDir.PersonRole.Add(newPersonRole);
            this.siteDir.ParticipantRole.Add(newParticipantRole);

            var rev = typeof(Thing).GetProperty("RevisionNumber");

            rev.SetValue(this.siteDir, 3);

            CDPMessageBus.Current.SendObjectChangeEvent(this.siteDir, EventKind.Updated);
            var personRoleRow      = viewmodel.Roles.First();
            var participantRoleRow = viewmodel.Roles.Last();

            Assert.AreEqual(2, personRoleRow.ContainedRows.Count);
            Assert.AreEqual(2, participantRoleRow.ContainedRows.Count);

            this.siteDir.PersonRole.Clear();
            this.siteDir.ParticipantRole.Clear();

            rev.SetValue(this.siteDir, 5);
            CDPMessageBus.Current.SendObjectChangeEvent(this.siteDir, EventKind.Updated);

            Assert.AreEqual(0, personRoleRow.ContainedRows.Count);
            Assert.AreEqual(0, participantRoleRow.ContainedRows.Count);

            viewmodel.Dispose();
        }
コード例 #2
0
        /// <summary>
        /// The event-handler that is invoked by the subscription that listens for updates
        /// on the <see cref="Session"/> that is being represented by the view-model
        /// </summary>
        /// <param name="sessionChange">
        /// The payload of the event that is being handled
        /// </param>
        private void SessionChangeEventHandler(SessionEvent sessionChange)
        {
            if (this.FluentRibbonManager == null)
            {
                return;
            }

            if (!this.FluentRibbonManager.IsActive)
            {
                return;
            }

            if (sessionChange.Status == SessionStatus.Open)
            {
                var session       = sessionChange.Session;
                var siteDirectory = session.RetrieveSiteDirectory();

                this.domainOfExpertiseBrowserViewModel = new DomainOfExpertiseBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService);
                this.modelBrowserViewModel             = new ModelBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService);
                this.naturalLanguageBrowserViewModel   = new NaturalLanguageBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService);
                this.organizationBrowserViewModel      = new OrganizationBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService);
                this.personBrowserViewModel            = new PersonBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService);
                this.roleBrowserViewModel    = new RoleBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService);
                this.siteRdlBrowserViewModel = new SiteRdlBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService);

                this.Session = session;
            }

            if (sessionChange.Status == SessionStatus.Closed)
            {
                this.CloseAll();
                this.Session = null;
            }
        }
コード例 #3
0
        public void VerifyThatSelectedSessionAreDisplayedInPropertyGrid()
        {
            var viewmodel = new RoleBrowserViewModel(this.session.Object, this.siteDir, null, this.navigation.Object, null, null);

            viewmodel.SelectedThing = viewmodel.Roles.First();
            this.navigation.Verify(x => x.Open(It.IsAny <Thing>(), this.session.Object));
        }
コード例 #4
0
        public void VerifyThatSelectedSessionAreDisplayedInPropertyGrid()
        {
            var viewmodel = new RoleBrowserViewModel(this.session.Object, this.siteDir, null, this.navigation.Object, null, null);

            var selectedThingChangedRaised = false;

            CDPMessageBus.Current.Listen <SelectedThingChangedEvent>().Subscribe(_ => selectedThingChangedRaised = true);

            viewmodel.SelectedThing = viewmodel.Roles.First();
            Assert.IsTrue(selectedThingChangedRaised);
        }
コード例 #5
0
        public void VerifyThatPropertiesAreSet()
        {
            var viewmodel = new RoleBrowserViewModel(this.session.Object, this.siteDir, null, this.navigation.Object, null, null);

            Assert.That(viewmodel.Caption, Is.Not.Null.Or.Empty);
            Assert.That(viewmodel.ToolTip, Is.Not.Null.Or.Empty);

            Assert.IsTrue(viewmodel.CreateParticipantRoleCommand.CanExecute(null));
            Assert.IsTrue(viewmodel.CreatePersonRoleCommand.CanExecute(null));

            var personRoleRow      = viewmodel.Roles.First();
            var participantRoleRow = viewmodel.Roles.Last();

            Assert.IsNotEmpty(personRoleRow.ContainedRows);
            Assert.IsNotEmpty(participantRoleRow.ContainedRows);
        }
コード例 #6
0
        /// <summary>
        /// Close all the panels and dispose of them
        /// </summary>
        private void CloseAll()
        {
            this.PanelNavigationService.Close(this.domainOfExpertiseBrowserViewModel, false);
            this.domainOfExpertiseBrowserViewModel = null;

            this.PanelNavigationService.Close(this.modelBrowserViewModel, false);
            this.modelBrowserViewModel = null;

            this.PanelNavigationService.Close(this.naturalLanguageBrowserViewModel, false);
            this.naturalLanguageBrowserViewModel = null;

            this.PanelNavigationService.Close(this.organizationBrowserViewModel, false);
            this.organizationBrowserViewModel = null;

            this.PanelNavigationService.Close(this.personBrowserViewModel, false);
            this.personBrowserViewModel = null;

            this.PanelNavigationService.Close(this.roleBrowserViewModel, false);
            this.roleBrowserViewModel = null;

            this.PanelNavigationService.Close(this.siteRdlBrowserViewModel, false);
            this.siteRdlBrowserViewModel = null;
        }