Esempio n. 1
0
        public void Refresh_RefreshesActiveItemVM()
        {
            UserVM vm = CreateUserVMWithItems();

            var oldSelection = vm.Department;

            DepartmentVM oldSelectedItem = oldSelection
                                           .SelectedItem
                                           .GetValue(x => x.VM);

            string oldName = oldSelectedItem.GetValue(x => x.CachedName);

            string newName = "New name";

            vm.Source.Department.Name = newName;

            vm.Refresh(x => x.Department);

            var newSelection = vm.Department;

            DepartmentVM newSelectedItem = newSelection
                                           .SelectedItem
                                           .GetValue(x => x.VM);

            string actualName = newSelectedItem.GetValue(x => x.CachedName);

            Assert.AreEqual(newName, actualName);
        }
Esempio n. 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);
        }
Esempio n. 3
0
        public void UpdateFromSource()
        {
            UserVM vm = new UserVM();

            vm.Refresh(UserVM.ClassDescriptor.Department);
        }