public void VerifyPossiblePerson()
        {
            var participant = new Participant(Guid.NewGuid(), this.cache, this.uri)
            {
                Person = this.person
            };

            this.clone.Participant.Add(participant);
            var dialog = new ParticipantDialogViewModel(participant, this.thingTransaction, this.session.Object,
                                                        true, ThingDialogKind.Create, this.thingDialogNavigationService.Object, this.clone);

            Assert.AreEqual(0, dialog.PossiblePerson.Count);

            this.sitedir.Person.Add(new Person(Guid.NewGuid(), this.cache, this.uri));
            participant = new Participant(Guid.NewGuid(), this.cache, this.uri);
            this.clone.Participant.Clear();
            dialog = new ParticipantDialogViewModel(participant, this.thingTransaction, this.session.Object, true, ThingDialogKind.Create,
                                                    this.thingDialogNavigationService.Object, this.clone);

            Assert.AreEqual(2, dialog.PossiblePerson.Count);
            dialog.SelectedPerson = this.person;
            Assert.IsTrue(dialog.Domain.Contains(this.domain));

            participant.Person = this.person;
            dialog             = new ParticipantDialogViewModel(participant, this.thingTransaction, this.session.Object, true, ThingDialogKind.Update, this.thingDialogNavigationService.Object, this.clone);

            Assert.AreEqual(1, dialog.PossiblePerson.Count);
        }
        public void VerifyThatPropertiesArePopulated()
        {
            var participant = new Participant(Guid.NewGuid(), this.cache, this.uri);
            var dialog      = new ParticipantDialogViewModel(participant, this.thingTransaction, this.session.Object,
                                                             true, ThingDialogKind.Create, this.thingDialogNavigationService.Object, this.clone);

            Assert.AreEqual(1, dialog.PossibleDomain.Count);
            Assert.AreEqual(1, dialog.PossiblePerson.Count);
            Assert.AreEqual(1, dialog.PossibleRole.Count);

            dialog.Domain = new ReactiveList <DomainOfExpertise> {
                this.domain
            };

            Assert.IsNotNull(dialog.SelectedSelectedDomain);

            dialog.SelectedPerson = this.person;
            dialog.SelectedRole   = this.role;

            Assert.IsTrue(dialog.OkCanExecute);
        }
        public void VerifyOkCanExecute()
        {
            var participant = new Participant(Guid.NewGuid(), this.cache, this.uri);

            var dialog = new ParticipantDialogViewModel(participant, this.thingTransaction, this.session.Object,
                                                        true, ThingDialogKind.Create, this.thingDialogNavigationService.Object, this.clone);

            Assert.IsFalse(dialog.OkCanExecute);

            dialog.SelectedPerson = this.person;
            Assert.IsFalse(dialog.OkCanExecute);

            dialog.SelectedRole = this.role;
            Assert.IsTrue(dialog.OkCanExecute);

            dialog.Domain = new ReactiveList <DomainOfExpertise> {
                this.domain
            };
            Assert.IsTrue(dialog.OkCanExecute);

            dialog.Domain.Clear();
            Assert.IsFalse(dialog.OkCanExecute);

            dialog.Domain = new ReactiveList <DomainOfExpertise> {
                this.domain
            };
            Assert.IsTrue(dialog.OkCanExecute);

            dialog.SelectedSelectedDomain = null;
            Assert.IsFalse(dialog.OkCanExecute);

            dialog.SelectedSelectedDomain = new DomainOfExpertise(Guid.NewGuid(), this.cache, this.uri);
            Assert.IsFalse(dialog.OkCanExecute);

            dialog.Domain.Add(dialog.SelectedSelectedDomain);
            Assert.IsTrue(dialog.OkCanExecute);
        }
        public void VerifyThatDefaultConstructorDoesNotThrowException()
        {
            var participantDialogViewModel = new ParticipantDialogViewModel();

            Assert.IsNotNull(participantDialogViewModel);
        }