示例#1
0
        public void VerifyThatValidationWorksOnPassword()
        {
            var transactionContext = TransactionContextResolver.ResolveContext(this.siteDir);
            var transaction        = new ThingTransaction(transactionContext, this.clone);

            var vm = new PersonDialogViewModel(this.person.Clone(false), transaction, this.session.Object, true,
                                               ThingDialogKind.Update, null, this.clone);

            Assert.AreEqual(0, vm.ValidationErrors.Count);

            // assert 2 errors messages are added when password update is activated
            vm.PwdEditIsChecked = true;

            Assert.That(vm["Password"], Is.Not.Null.Or.Empty);
            Assert.That(vm["PasswordConfirmation"], Is.Not.Null.Or.Empty);

            Assert.AreEqual(2, vm.ValidationErrors.Count);

            // assert that the errors are removed upon good password match
            vm.Password             = "******";
            vm.PasswordConfirmation = "123";

            Assert.That(vm["Password"], Is.Null.Or.Empty);
            Assert.That(vm["PasswordConfirmation"], Is.Null.Or.Empty);

            Assert.AreEqual(0, vm.ValidationErrors.Count);

            Assert.IsTrue(vm.OkCommand.CanExecute(null));
        }
示例#2
0
 public StudentDialogView(Person person)
 {
     InitializeComponent();
     DataContext = new PersonDialogViewModel()
     {
         Person = person
     };
 }
示例#3
0
        public void VerifyThatUpdateTransactionDoesnotUpdatePassword()
        {
            var transactionContext = TransactionContextResolver.ResolveContext(this.siteDir);
            var transaction        = new ThingTransaction(transactionContext, this.clone);

            var vm = new PersonDialogViewModel(this.person.Clone(false), transaction, this.session.Object, true,
                                               ThingDialogKind.Update, null, this.clone);

            vm.OkCommand.Execute(null);
            var personclone = transaction.UpdatedThing.Select(x => x.Value).OfType <Person>().Single();

            Assert.AreEqual(this.person.Password, personclone.Password);
        }
示例#4
0
        public void VerifyThatSetDefaultTelephoneNumberWorks()
        {
            var transactionContext = TransactionContextResolver.ResolveContext(this.siteDir);
            var transaction        = new ThingTransaction(transactionContext, this.clone);
            var pers  = new Person(Guid.NewGuid(), this.cache, this.uri);
            var phone = new TelephoneNumber(Guid.NewGuid(), this.cache, this.uri);

            pers.TelephoneNumber.Add(phone);

            var vm = new PersonDialogViewModel(pers, transaction, this.session.Object, true,
                                               ThingDialogKind.Create, null, this.clone);

            vm.SelectedTelephoneNumber = vm.TelephoneNumber.Single();
            vm.SetDefaultTelephoneNumberCommand.Execute(null);

            Assert.AreSame(vm.SelectedDefaultTelephoneNumber, phone);
        }
示例#5
0
        public void VerifyThatSetDefaultEmailAddressWorks()
        {
            var transactionContext = TransactionContextResolver.ResolveContext(this.siteDir);
            var transaction        = new ThingTransaction(transactionContext, this.clone);

            var pers  = new Person(Guid.NewGuid(), this.cache, this.uri);
            var email = new EmailAddress(Guid.NewGuid(), this.cache, this.uri);

            pers.EmailAddress.Add(email);

            var vm = new PersonDialogViewModel(pers, transaction, this.session.Object, true,
                                               ThingDialogKind.Create, null, this.clone);

            vm.SelectedEmailAddress = vm.EmailAddress.Single();
            vm.SetDefaultEmailAddressCommand.Execute(null);

            Assert.AreSame(vm.SelectedDefaultEmailAddress, email);
        }
 private void GivenPerson()
 {
     viewModel = new PersonDialogViewModel(personServiceMock.Object, dispatcherMock.Object, aggregatorMock.Object, dialogServiceMock.Object, persons[0]);
 }
示例#7
0
        public void VerifyThatDefaultConstructorDoesNotThrowException()
        {
            var personDialogViewModel = new PersonDialogViewModel();

            Assert.IsNotNull(personDialogViewModel);
        }