public Person(Person other) { this.name = other.Name; this.Occupation = other.Occupation; this.culinaryRating = other.CulinaryRating; this.birthDate = other.BirthDate; this.hourlyRate = other.GetRate(); this.CanTellJokes = other.CanTellJokes; this.Photo = other.Photo; this.Comments = other.Comments; }
protected bool Equals(Person other) { return string.Equals(name, other.name); }
public void AddChild(Person child) { Children.Add(child); child.Parent = this; }
void olv_ItemCheck(object sender, ItemCheckEventArgs e) { this.personInEvent = (Person)this.olv.GetItem(e.Index).RowObject; this.stateInEvent = e.NewValue; }
public void Test_RefreshObject() { this.olv.SetObjects(PersonDb.All); Person another = new Person(PersonDb.All[1].Name); another.Occupation = "a new occupation"; OLVListItem item = this.olv.ModelToItem(another); Assert.IsNotNull(item); Assert.AreNotEqual(another.Occupation, item.SubItems[1].Text); this.olv.RefreshObject(another); OLVListItem item2 = this.olv.ModelToItem(another); Assert.IsNotNull(item2); Assert.AreEqual(another.Occupation, item2.SubItems[1].Text); }
public void Test_RefreshObject_NonRoot_AfterRemoveChild() { this.olv.ClearObjects(); Assert.AreEqual(0, this.olv.GetItemCount()); Person root = new Person("root"); Person child = new Person("child"); Person grandchild = new Person("grandchild"); root.AddChild(child); child.AddChild(grandchild); grandchild.AddChild(new Person("ggrandchild1")); grandchild.AddChild(new Person("ggrandchild2")); grandchild.AddChild(new Person("ggrandchild3")); this.olv.Roots = new ArrayList(new object[] {root}); this.olv.ExpandAll(); Assert.AreEqual(3, ObjectListView.EnumerableCount(this.olv.GetChildren(grandchild))); child.Children.RemoveAt(0); this.olv.RefreshObject(child); Assert.AreEqual(2, this.olv.GetItemCount()); }
public void Test_HierarchicalCheckBoxes_CheckedObjects_Get_IncludesCheckedObjectsNotInControl() { Person firstRoot = PersonDb.All[0]; this.olv.CollapseAll(); Assert.IsEmpty(this.olv.CheckedObjects); this.olv.HierarchicalCheckboxes = true; this.olv.Expand(firstRoot); Person newGuy = new Person("someone new"); this.olv.CheckObject(newGuy); ArrayList checkedObjects = new ArrayList(this.olv.CheckedObjects); Assert.AreEqual(1, checkedObjects.Count); Assert.AreEqual(((Person)checkedObjects[0]).Name, newGuy.Name); }