public void VerifyThatUpdateToTelephoneNumberAreProcessed()
        {
            var firstNumber = new TelephoneNumber(Guid.NewGuid(), this.cache, this.url);

            firstNumber.Value = "123456879";
            this.person.TelephoneNumber.Add(firstNumber);

            var secondNumner = new TelephoneNumber(Guid.NewGuid(), this.cache, this.url);

            secondNumner.Value = "987654321";
            this.person.TelephoneNumber.Add(secondNumner);

            this.teamCompositionCardViewModel = new TeamCompositionCardViewModel(this.participant, this.session.Object, null);

            Assert.AreEqual(firstNumber.Value, this.teamCompositionCardViewModel.TelephoneNumber);

            firstNumber.Value = "456789123";
            var type = firstNumber.GetType();

            type.GetProperty("RevisionNumber").SetValue(firstNumber, 50);

            CDPMessageBus.Current.SendObjectChangeEvent(firstNumber, EventKind.Updated);

            Assert.AreEqual(firstNumber.Value, this.teamCompositionCardViewModel.TelephoneNumber);
        }
        public void VerifyThatUpdateToEmailAddressIsProcessed()
        {
            var firstEmail = new EmailAddress(Guid.NewGuid(), this.cache, this.url)
            {
                Value = "*****@*****.**"
            };

            this.person.EmailAddress.Add(firstEmail);

            var secondEmail = new EmailAddress(Guid.NewGuid(), this.cache, this.url)
            {
                Value = "*****@*****.**"
            };

            this.person.EmailAddress.Add(secondEmail);

            this.teamCompositionCardViewModel = new TeamCompositionCardViewModel(this.participant, this.session.Object, null);

            firstEmail.Value = "*****@*****.**";
            var type = firstEmail.GetType();

            type.GetProperty("RevisionNumber").SetValue(firstEmail, 50);

            CDPMessageBus.Current.SendObjectChangeEvent(firstEmail, EventKind.Updated);

            Assert.AreEqual(firstEmail.Value, this.teamCompositionCardViewModel.EmailAddress);
        }
        public void VerifyThatEmailCanExecuteIsFalseWhenNoEmailExists()
        {
            this.teamCompositionCardViewModel = new TeamCompositionCardViewModel(this.participant, this.session.Object, null);

            Assert.That(this.teamCompositionCardViewModel.EmailAddress, Is.Null.Or.Empty);

            Assert.IsFalse(this.teamCompositionCardViewModel.OpenEmail.CanExecute(null));
        }
        public void VerifyThatPropertiesAreSet()
        {
            this.teamCompositionCardViewModel = new TeamCompositionCardViewModel(this.participant, this.session.Object, null);

            Assert.AreEqual("RHEA", this.teamCompositionCardViewModel.Organization);
            Assert.AreEqual("SESS", this.teamCompositionCardViewModel.OrganizationalUnit);
            Assert.AreEqual("SYS THR", this.teamCompositionCardViewModel.DomainShortnames);
            Assert.IsTrue(this.teamCompositionCardViewModel.IsActive);
        }
        public void VerifyThatIfEmailIsPresentEmailCanExecuteIsTrue()
        {
            var email = new EmailAddress(Guid.NewGuid(), this.cache, this.url)
            {
                Value = "*****@*****.**"
            };

            this.person.EmailAddress.Add(email);

            this.teamCompositionCardViewModel = new TeamCompositionCardViewModel(this.participant, this.session.Object, null);

            Assert.AreEqual(email.Value, this.teamCompositionCardViewModel.EmailAddress);

            Assert.IsTrue(this.teamCompositionCardViewModel.OpenEmail.CanExecute(null));
        }
        public void VerifyThatIfNoDefaultTelephoneNumberIsUsedFirsTelephoneNumberIsUsed()
        {
            var firstNumber = new TelephoneNumber(Guid.NewGuid(), this.cache, this.url);

            firstNumber.Value = "123456879";
            this.person.TelephoneNumber.Add(firstNumber);

            var secondNumner = new TelephoneNumber(Guid.NewGuid(), this.cache, this.url);

            secondNumner.Value = "987654321";
            this.person.TelephoneNumber.Add(secondNumner);

            this.teamCompositionCardViewModel = new TeamCompositionCardViewModel(this.participant, this.session.Object, null);

            Assert.AreEqual(firstNumber.Value, this.teamCompositionCardViewModel.TelephoneNumber);
        }
        public void VerifyThatParticipantRoleUpdatesAreProcessed()
        {
            this.participantRole.Name = "Participant Role";

            this.teamCompositionCardViewModel = new TeamCompositionCardViewModel(this.participant, this.session.Object, null);

            Assert.AreEqual(this.participantRole.Name, this.teamCompositionCardViewModel.ParticipantRole);

            this.participantRole.Name = "Updated Participant Role";
            var type = this.participantRole.GetType();

            type.GetProperty("RevisionNumber").SetValue(this.participantRole, 50);

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

            Assert.AreEqual(this.participantRole.Name, this.teamCompositionCardViewModel.ParticipantRole);
        }
        public void VerifyThatPersonUpdatesAreProcessed()
        {
            this.person.GivenName = "John";
            this.person.Surname   = "Doe";

            this.teamCompositionCardViewModel = new TeamCompositionCardViewModel(this.participant, this.session.Object, null);

            Assert.AreEqual(this.person.Name, this.teamCompositionCardViewModel.Person);

            this.person.GivenName = "Jane";
            var type = this.person.GetType();

            type.GetProperty("RevisionNumber").SetValue(this.person, 50);

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

            Assert.AreEqual(this.person.Name, this.teamCompositionCardViewModel.Person);
        }
        public void VerifuThatIfNoDefaultEmailIsSetFirstEmailIsUsed()
        {
            var firstEmail = new EmailAddress(Guid.NewGuid(), this.cache, this.url)
            {
                Value = "*****@*****.**"
            };

            this.person.EmailAddress.Add(firstEmail);

            var secondEmail = new EmailAddress(Guid.NewGuid(), this.cache, this.url)
            {
                Value = "*****@*****.**"
            };

            this.person.EmailAddress.Add(secondEmail);

            this.teamCompositionCardViewModel = new TeamCompositionCardViewModel(this.participant, this.session.Object, null);

            Assert.AreEqual(firstEmail.Value, this.teamCompositionCardViewModel.EmailAddress);
        }
        public void VerifThatDefaultEmailAddresIsUsed()
        {
            var email = new EmailAddress(Guid.NewGuid(), this.cache, this.url)
            {
                Value = "*****@*****.**"
            };

            this.person.EmailAddress.Add(email);

            var defaultEmail = new EmailAddress(Guid.NewGuid(), this.cache, this.url)
            {
                Value = "*****@*****.**"
            };

            this.person.EmailAddress.Add(defaultEmail);
            this.person.DefaultEmailAddress = defaultEmail;

            this.teamCompositionCardViewModel = new TeamCompositionCardViewModel(this.participant, this.session.Object, null);

            Assert.AreEqual(defaultEmail.Value, this.teamCompositionCardViewModel.EmailAddress);
        }