public void MemberListFromExistingListMatchesIndices() { var memberListFromExistingList = new MemberList(_listOfMembers); Assert.Equal(0, memberListFromExistingList.IndexOf(_fieldA)); Assert.Equal(1, memberListFromExistingList.IndexOf(_propertyA)); Assert.Equal(2, memberListFromExistingList.IndexOf(_methodA)); }
public void SuccessfullyGetMemberIndex() { Assert.Empty(_memberList); _memberList.Add(_methodA); Assert.Single(_memberList); Assert.Equal(0, _memberList.IndexOf(_methodA)); }
/// <summary> /// replaces the selected member with new data /// </summary> /// <param name="obj"></param> private void OnReceiveMessageUAction(Messages obj) { Member m = new Member(obj.firstName, obj.lastName, obj.email); int i = MemberList.IndexOf(SelectedMember); MemberList[i] = m; this.RaisePropertyChanged(() => this.MemberList); Messenger.Default.Unregister <Messages>(this, OnReceiveMessageUAction); }
/// <summary> /// Gets a new member for the list. /// </summary> /// <param name="m">The member to add. The message denotes how it is added. /// "Update" replaces at the specified index, "Add" adds it to the list.</param> public void ReceiveMember(MessageMember m) { if (m.Message == "Update") { var i = MemberList.IndexOf(selectedMember); MemberList[i] = new Member(m.FirstName, m.LastName, m.Email); database.SaveMemberships(MemberList); } else if (m.Message == "Add") { MemberList.Add(new Member(m.FirstName, m.LastName, m.Email)); database.SaveMemberships(MemberList); } }
/// <summary> /// Gets a new member for the list. /// </summary> /// <param name="m">The member to add. The message denotes how it is added. /// "Update" replaces at the specified index, "Add" adds it to the list.</param> public void ReceiveMember(MessageMember m) { if (m.Message == "Update") { // (Missing) -> Update the Members implementation var i = MemberList.IndexOf(selectedMember); MemberList[i] = new Member(m.FirstName, m.LastName, m.Email); database.SaveMemberships(); } else if (m.Message == "Add") { // (Missing) -> Add the Members implementation MemberList.Add(new Member(m.FirstName, m.LastName, m.Email)); database.SaveMemberships(); } }
/// <summary> /// Gets a new member for the list. /// </summary> /// <param name="m">The member to add. The message denotes how it is added. /// "Update" replaces at the specified index, "Add" adds it to the list.</param> public void ReceiveMember(MessageMember m) { if (m.Message == "Update") { /* Another method for update * SelectedMember.FirstName = m.FirstName; * SelectedMember.LastName = m.LastName; * SelectedMember.Email = m.Email; * _database.SaveMemberships(); * _members = _database.GetMemberships(); * RaisePropertyChanged("MemberList"); */ MemberList[MemberList.IndexOf(SelectedMember)] = new Member(m.FirstName, m.LastName, m.Email); } else if (m.Message == "Add") { MemberList.Add(new Member(m.FirstName, m.LastName, m.Email)); } _database.SaveMemberships(); }