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); } }
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); }
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); } }