public void MatchMinuteValueIsComparableNotEqualValue() { var matchMinuteOne = new MatchMinute(4); var matchMinuteTwo = new MatchMinute(5); Assert.IsTrue(matchMinuteOne.Value != matchMinuteTwo.Value); }
public void MatchMinuteValueIsComparableEqualValueOperator() { var matchMinuteOne = new MatchMinute(4); var matchMinuteTwo = new MatchMinute(4); Assert.IsTrue(matchMinuteOne.Value == matchMinuteTwo.Value); }
private void playerListbox_SelectionChanged(object sender, SelectionChangedEventArgs e) { Player selectedPlayer = new Player(); selectedPlayer = (Player)playerListbox.SelectedItem; List <Guid> PlayerInIdsList = new List <Guid>(Exchanges.Select(ex => ex.PlayerInId).ToList()); List <Guid> PlayerOutIdsList = new List <Guid>(Exchanges.Select(ex => ex.PlayerOutId).ToList()); List <MatchMinute> minutes = new List <MatchMinute>(); for (int i = 1; i <= MatchLength; i++) { MatchMinute min = new MatchMinute(); min.Value = i; minutes.Add(min); } if (PlayerInIdsList.Contains(selectedPlayer.Id)) { Exchange activeExchange = Exchanges.Find(ex => ex.PlayerInId == selectedPlayer.Id); minutes = minutes.Where(m => m.Value >= activeExchange.TimeOfExchange.Value).ToList(); } if (PlayerOutIdsList.Contains(selectedPlayer.Id)) { Exchange activeExchange = Exchanges.Find(ex => ex.PlayerOutId == selectedPlayer.Id); minutes = minutes.Where(m => m.Value <= activeExchange.TimeOfExchange.Value).ToList(); } timeBox.ItemsSource = minutes; }
public void MatchMinuteValueIsComparableEqualValueEquals() { var matchMinuteOne = new MatchMinute(4); var matchMinuteTwo = new MatchMinute(4); Assert.IsTrue(matchMinuteOne.Value.Equals(matchMinuteTwo.Value)); }
public void GoalThrowsNullExeption() { MatchMinute minute = null; var playerId = Guid.NewGuid(); new Goal(minute, this.playerTeamIdOne, playerId); }
private void Ok_Click(object sender, RoutedEventArgs e) { Player player = (Player)playerListbox.SelectedItem; TimeOfEvent = (MatchMinute)timeBox.SelectedItem; Result = new Event(player.Id, TimeOfEvent); DialogResult = true; }
public void MatchMinuteIsComparableEqualValue() { var matchMinuteOne = new MatchMinute(4); var matchMinuteTwo = new MatchMinute(4); var test = matchMinuteOne == matchMinuteTwo; Assert.AreEqual(matchMinuteOne, matchMinuteTwo); }
public void EqualsWorkWithValueAndReferenceTypes() { var name = new Name("John", "Doe"); var name2 = new Name("John", "Doe"); var time = new MatchMinute(30); var time2 = new MatchMinute(30); Assert.IsTrue(name.Equals(name2) && time.Equals(time2)); }
public void MatchMinuteWorksWithHashSet() { var matchMinuteOne = new MatchMinute(58); var matchMinuteTwo = new MatchMinute(58); var hashSet = new HashSet <MatchMinute> { matchMinuteOne, matchMinuteTwo }; Assert.IsTrue(hashSet.Count == 1); }
private void RemoveAssistFromGame(Guid gameId, Guid playerId, int matchMinute) { var matchMin = new MatchMinute(matchMinute); var game = this.FindById(gameId); foreach (var assist in game.Protocol.Assists) { if (assist.PlayerId == playerId && assist.MatchMinute == matchMin) { game.Protocol.Assists.Remove(assist); break; } } }
private void RemoveYellowCardFromGame(Guid gameId, Guid playerId, int matchMinute) { var matchMin = new MatchMinute(matchMinute); var game = this.FindById(gameId); foreach (var card in game.Protocol.Cards) { if (card.PlayerId == playerId && card.MatchMinute == matchMin && card.CardType == CardType.Yellow) { game.Protocol.Cards.Remove(card); break; } } }
private void RemoveGoalFromGame(Guid gameId, Guid playerId, int matchMinute) { var matchMin = new MatchMinute(matchMinute); var game = this.FindById(gameId); foreach (var goal in game.Protocol.Goals) { if (goal.PlayerId == playerId && goal.MatchMinute == matchMin) { game.Protocol.Goals.Remove(goal); break; } } }
private void RemovePenaltyFromGame(Guid gameId, Guid playerId, int matchMinute) { var matchMin = new MatchMinute(matchMinute); var game = this.FindById(gameId); foreach (var penalty in game.Protocol.Penalties) { if (penalty.PlayerId == playerId && penalty.MatchMinute == matchMin) { game.Protocol.Penalties.Remove(penalty); if (penalty.IsGoal) { this.RemoveGoalFromGame(gameId, playerId, matchMinute); } break; } } }
public void MatchMinuteCantBeMoreThan120() { var matchMinute = new MatchMinute(121); Assert.IsTrue(matchMinute.Value == 121); }
public void MatchMinuteCanBeAssignedValidValue() { var matchMinute = new MatchMinute(90); Assert.IsTrue(matchMinute.Value == 90); }
public void MatchMinuteToStringMoreThan90() { var matchMinute = new MatchMinute(91); Assert.AreEqual(matchMinute.ToString(), "90+1"); }
public void MatchMinuteToStringLessThan91() { var matchMinute = new MatchMinute(90); Assert.AreEqual(matchMinute.ToString(), "90"); }
public void MatchMinuteCantBeLessThanOneMinute() { var matchMinute = new MatchMinute(0); Assert.IsTrue(matchMinute.Value == 1); }
private void Ok_Click(object sender, RoutedEventArgs e) { MatchMinute.TryParse(timeBox.SelectedIndex + 1, out TimeOfEvent); Result = new Exchange(PlayerOut.Id, PlayerIn.Id, TimeOfEvent); DialogResult = true; }