コード例 #1
0
        public void VerifyThatIfNewParticipantIsAddedItIsAddedToTheBrowser()
        {
            var vm = new TeamCompositionBrowserViewModel(this.engineeringModelSetup, this.session.Object, this.thingDialogNavigationService.Object, this.panelNavigationService.Object, this.dialogNavigationService.Object, null);

            Assert.AreEqual(1, vm.Participants.Count);

            var anotherPerson = new Person(Guid.NewGuid(), this.cache, this.uri)
            {
                GivenName = "Jane", Surname = "Doe"
            };

            anotherPerson.Role = this.personRole;

            var anotherParticipant = new Participant(Guid.NewGuid(), this.cache, this.uri)
            {
                Person = anotherPerson,
                Role   = this.participantRole
            };

            anotherParticipant.Domain.Add(this.systemEngineering);
            this.engineeringModelSetup.Participant.Add(anotherParticipant);

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

            revisionNumber.SetValue(this.engineeringModelSetup, this.engineeringModelSetup.RevisionNumber + 1);

            CDPMessageBus.Current.SendObjectChangeEvent(anotherPerson, EventKind.Added);
            CDPMessageBus.Current.SendObjectChangeEvent(this.engineeringModelSetup, EventKind.Updated);

            Assert.AreEqual(2, vm.Participants.Count);
        }
コード例 #2
0
        public void VerifyThatPropertiesAreSet()
        {
            var vm = new TeamCompositionBrowserViewModel(this.engineeringModelSetup, this.session.Object, this.thingDialogNavigationService.Object, this.panelNavigationService.Object, this.dialogNavigationService.Object, null);

            Assert.AreEqual("Team Composition, test model", vm.Caption);
            Assert.AreEqual(1, vm.Participants.Count);

            var row = vm.Participants.Single();

            Assert.AreEqual(this.participant, row.Thing);
        }
コード例 #3
0
        public void VerifyThatIfParticipantIsRemovedItIsRemovedFromTheBrowser()
        {
            var vm = new TeamCompositionBrowserViewModel(this.engineeringModelSetup, this.session.Object, this.thingDialogNavigationService.Object, this.panelNavigationService.Object, this.dialogNavigationService.Object, null);

            Assert.AreEqual(1, vm.Participants.Count);
            this.engineeringModelSetup.Participant.Clear();

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

            revisionNumber.SetValue(this.engineeringModelSetup, this.engineeringModelSetup.RevisionNumber + 1);

            CDPMessageBus.Current.SendObjectChangeEvent(this.engineeringModelSetup, EventKind.Updated);

            Assert.AreEqual(0, vm.Participants.Count);
        }