public void VerifyOkButtonWorks() { var vm = new FileDialogViewModel(this.file, this.thingTransaction, this.session.Object, true, ThingDialogKind.Update, this.thingDialogNavigationService.Object, this.store); Assert.IsFalse(vm.OkCanExecute); vm.SelectedOwner = this.domain; Assert.IsFalse(vm.OkCanExecute); var fileRevision = new FileRevision(Guid.NewGuid(), null, null); var fileRevisionVm = new FileRevisionRowViewModel(fileRevision, this.session.Object, vm); vm.FileRevision.Add(fileRevisionVm); Assert.IsTrue(vm.OkCanExecute); vm.IsLocked = true; Assert.IsTrue(vm.OkCanExecute); vm.IsLocked = false; Assert.IsTrue(vm.OkCanExecute); var otherPerson = new Person(Guid.NewGuid(), this.assembler.Cache, this.uri) { ShortName = "otherperson", GivenName = "otherperson", }; vm.IsLocked = true; vm.SelectedLockedBy = otherPerson; Assert.IsFalse(vm.OkCanExecute); }
public void VerifyThatLockingMechanismeWorks() { var vm = new FileDialogViewModel(this.file, this.thingTransaction, this.session.Object, false, ThingDialogKind.Update, this.thingDialogNavigationService.Object, this.store); Assert.IsFalse(vm.IsLocked); Assert.IsNull(vm.LockedBy); Assert.IsTrue(vm.AllowEdit); vm.IsLocked = true; Assert.AreEqual(this.person.Name, vm.LockedBy); Assert.AreEqual(this.person, vm.SelectedLockedBy); Assert.IsTrue(vm.AllowEdit); vm.IsLocked = false; Assert.AreEqual(null, vm.LockedBy); Assert.AreEqual(null, vm.SelectedLockedBy); Assert.IsTrue(vm.AllowEdit); var otherPerson = new Person(Guid.NewGuid(), this.assembler.Cache, this.uri) { ShortName = "otherperson", GivenName = "otherperson", }; vm.IsLocked = true; vm.SelectedLockedBy = otherPerson; Assert.AreEqual(otherPerson.Name, vm.LockedBy); Assert.AreEqual(otherPerson, vm.SelectedLockedBy); Assert.IsFalse(vm.AllowEdit); }