public void Remove_Team_Test() { // arrange string name = "TestName"; int scoreA = 6; int scoreB = 9; int id = 98; //act Match testMatch = new Match() { Name = name, ID = id, TeamAScore = scoreA, TeamBScore = scoreB }; MatchList testmatchList = new MatchList(); testmatchList.Add(testMatch); testmatchList.Remove(id); //assert Match lookingMatch = testmatchList.FindByID(id); Assert.AreEqual(null, lookingMatch, "Incompatibility in Remove Match from list"); }
private void AddBet() { string bet = dbOperations.CreateBet(SelectedMatch.ID, Bet); if (bet == "") { MatchList.Remove(SelectedMatch); } else { MessageBox.Show("your bet " + bet); } }
private void Unmatch(MatchModel match) { var decision = MessageBox.Show($"Do you really want to unmatch with {match.Person.Name}?", "Are you sure about that?", MessageBoxButton.YesNo, MessageBoxImage.Exclamation); if (decision == MessageBoxResult.Yes) { try { SerializationHelper.MoveMatchToUnMatchedByMe(match); TinderHelper.UnmatchPerson(match.Id); MatchList.Remove(match); } catch (TinderRequestException e) { MessageBox.Show(e.Message); } } }
private async void UpdateMatches(object sender, EventArgs e) { try { var newUpdates = await TinderHelper.GetUpdates(SerializationHelper.GetLastUpdate()); if (newUpdates.Matches.Count != 0) { SerializationHelper.UpdateLastUpdate(newUpdates.LastActivityDate); foreach (var newMatch in newUpdates.Matches) { var matchToUpdate = MatchList.Where(item => item.Id == newMatch.Id).FirstOrDefault(); // There's an update to an existing match if (matchToUpdate != null) { // Adds new messages the to list foreach (var newMessage in newMatch.Messages) { if (!matchToUpdate.Messages.Contains(newMessage)) { matchToUpdate.Messages.Add(newMessage); } } if (!UpdatedMatches.Contains(matchToUpdate)) { UpdatedMatches.Add(matchToUpdate); } matchToUpdate.LastActivityDate = newMatch.LastActivityDate; new Task(() => SerializationHelper.SerializeMatch(matchToUpdate)).Start(); } // There's a new match else { new Task(() => SerializationHelper.SerializeMatch(newMatch)).Start(); MatchList.Insert(0, newMatch); NewMatchList.Add(newMatch); } } } if (newUpdates.Blocks.Count != 0) { foreach (var unmatched in newUpdates.Blocks) { var match = MatchList.Where(x => x.Id == unmatched).FirstOrDefault(); if (match != null) { SerializationHelper.MoveMatchToUnMatched(match); MatchList.Remove(match); MessageBox.Show(match.Person.Name + " unmatched you"); } } } FilterVM.SortMatchList(); } catch (TinderRequestException ex) { MessageBox.Show(ex.Message); } }