示例#1
0
        public void VerifyThatReactiveCommandCanExecuteProperly()
        {
            var vm = new OrganizationBrowserViewModel(this.session.Object, this.siteDir, this.dialogNavigation.Object, this.navigation.Object, null, null);

            Assert.IsTrue(vm.CreateCommand.CanExecute(null));
            Assert.IsFalse(vm.InspectCommand.CanExecute(null));
            Assert.IsFalse(vm.UpdateCommand.CanExecute(null));

            var organization = new Organization(Guid.NewGuid(), null, this.uri)
            {
                Name = "1", ShortName = "1"
            };

            CDPMessageBus.Current.SendObjectChangeEvent(organization, EventKind.Added);

            vm.SelectedThing = vm.Organizations.Single();
            vm.ComputePermission();

            Assert.IsTrue(vm.InspectCommand.CanExecute(null));
            Assert.IsTrue(vm.UpdateCommand.CanExecute(null));
        }