Beispiel #1
0
        public void EnableUndo_EnablesUndoSetValueBehavior()
        {
            UserVM vm = CreateUserVMWithItems();

            var department = vm.GetValue(x => x.Groups);

            var relevantProperties = new[] {
                department.GetProperty(x => x.AllItems),
                department.GetProperty(x => x.SelectedItems)
            };

            foreach (var property in relevantProperties)
            {
                bool found = false;
                for (IBehavior b = property.Behaviors; b != null; b = b.Successor)
                {
                    if (b.GetType().Name.Contains("UndoSetValueBehavior") ||
                        b.GetType().Name.Contains("UndoCollectionModifcationBehavior"))
                    {
                        found = true;
                        break;
                    }
                }
                Assert.IsTrue(found);
            }
        }
Beispiel #2
0
        public void Refresh_DoesNotClearSourceItems()
        {
            var selectedGroups = new[] { Group1, Group2 };

            UserVM vm = CreateUserVM(
                allGroups: new[] { Group1, Group2, Group3, InactiveGroup },
                selectedGroups: selectedGroups
                );

            vm.GetValue(x => x.Groups).Load(x => x.SelectedItems);
            vm.GetValue(x => x.Groups).Load(x => x.AllItems);

            vm.Refresh();

            var actualSelectedSource = vm
                                       .Source
                                       .Groups
                                       .ToArray();

            CollectionAssert.AreEqual(selectedGroups, actualSelectedSource);
        }
Beispiel #3
0
        public void EnableUndo_EnablesUndoSetValueBehavior()
        {
            UserVM vm = new UserVM();

            IViewModel department = vm.GetValue(x => x.Department);

            foreach (var property in department.Descriptor.Properties)
            {
                bool found = false;
                for (IBehavior b = property.Behaviors; b != null; b = b.Successor)
                {
                    if (b.GetType().Name.Contains("UndoSetValueBehavior") ||
                        b.GetType().Name.Contains("UndoCollectionModifcationBehavior"))
                    {
                        found = true;
                        break;
                    }
                }
                Assert.IsTrue(found);
            }
        }