public void GetValueOfSelectedItems_DoesNotLoadAllItems() { var vm = CreateUserVMWithItems(); vm.Groups.GetValue(x => x.SelectedItems); ViewModelAssert.IsNotLoaded(vm.Groups, x => x.AllItems); }
public void GetValueOfSelectedItem_DoesNotLoadAllItems() { var vm = CreateUserVMWithItems(); vm.Department.GetValue(x => x.SelectedItem); ViewModelAssert.IsNotLoaded(vm.Department, x => x.AllItems); }
public void SetSelectedSourceItems_DoesNotLoadAllItems() { var vm = CreateUserVMWithItems(); vm.Groups.Load(x => x.SelectedItems); vm.Groups.SelectedSourceItems = new[] { Group1, Group3 }; ViewModelAssert.IsNotLoaded(vm.Groups, x => x.AllItems); }
public void SetSelectedSourceItem_DoesNotLoadAllItems() { var vm = CreateUserVMWithItems(); vm.Department.Load(x => x.SelectedItem); vm.Department.SelectedSourceItem = Department2; ViewModelAssert.IsNotLoaded(vm.Department, x => x.AllItems); }
public void Revalidate_DoesNotLoadAllItems() { var vm = CreateUserVMWithItems(); vm.Groups.Load(x => x.SelectedItems); vm.Groups.Revalidate(ValidationScope.SelfAndLoadedDescendants); ViewModelAssert.IsNotLoaded(vm.Groups, x => x.AllItems); }
public void RefreshDescendants_DoesNotLoadUnloadedProperties() { var root = new RootVM(); root.RefreshDescendants(b => { b.Descendant(x => x.Children) .Properties(x => x.RefreshDetectionProperty); }); ViewModelAssert.IsNotLoaded(root, x => x.Children); }
public void AddChildToCollection_AfterRevalidateAllDescendantsHasBeenCalled_DoesLoadDescendantsOfNewChild() { VM.Revalidate(ValidationScope.SelfAndAllDescendants); var newChild = new ChildVM { Source = new ChildSource { Items = new List <GrandchildSource> { new GrandchildSource() } } }; ViewModelAssert.IsNotLoaded(newChild, x => x.Items); VM.GetValue(x => x.Children).Add(newChild); ViewModelAssert.IsNotLoaded(newChild, x => x.Items); }
public void RollbackTo_WhenCollectionLoadedAfterRollbackPoint_DoesNotClearCollection() { Employee employee = new Employee(); employee.Projects.Add(new Project()); EmployeeVM.InitializeFrom(employee); IRollbackPoint rollbackPoint = EmployeeVM.UndoManager.GetRollbackPoint(); ViewModelAssert.IsNotLoaded(EmployeeVM, x => x.Projects); EmployeeVM.Load(x => x.Projects); Assert.AreEqual(1, EmployeeVM.Projects.Count); EmployeeVM.UndoManager.RollbackTo(rollbackPoint); ViewModelAssert.IsLoaded(EmployeeVM, x => x.Projects); Assert.AreEqual(1, EmployeeVM.Projects.Count); }
public void GetDescendants_WhenOnlyLoadedIsTrue_DoesNotLoadDescendants() { var unloadedProject = new ProjectVM(); var loadedProject = new ProjectVM(); var selectedCustomer = new CustomerVM(); var customerItem = new CustomerVM(); loadedProject.SetValue(x => x.SelectedCustomer, selectedCustomer); loadedProject.GetValue(x => x.Customers).Add(customerItem); var rootVM = new EmployeeVM(); var projects = rootVM.GetValue(x => x.Projects); projects.Add(unloadedProject); projects.Add(loadedProject); var path = PathDefinition .Empty .Append((EmployeeVMDescriptor x) => x.Projects) .Append((ProjectVMDescriptor x) => x.SelectedCustomer); var descenantViewModels = path.GetLoadedDescendants(rootVM); CollectionAssert.AreEquivalent(new[] { selectedCustomer }, descenantViewModels); ViewModelAssert.IsNotLoaded(unloadedProject, x => x.SelectedCustomer); path = PathDefinition .Empty .Append((EmployeeVMDescriptor x) => x.Projects) .Append((ProjectVMDescriptor x) => x.Customers); descenantViewModels = path.GetLoadedDescendants(rootVM); CollectionAssert.AreEquivalent(new[] { customerItem }, descenantViewModels); ViewModelAssert.IsNotLoaded(unloadedProject, x => x.Customers); }
public void IsLoaded_WhenCacheIsPopulated_ReturnsTrue() { VM.Load(x => x.MappedProperty); ViewModelAssert.IsLoaded(VM, x => x.MappedProperty); }
public void IsLoaded_WhenCacheIsNotPopulated_ReturnsFalse() { ViewModelAssert.IsNotLoaded(VM, x => x.MappedProperty); }