/// <summary> /// Возвращает более позднее время, выбирая из предыдущего значения и нового /// </summary> /// <param name="timestamp">Новая временная метка окончания матча</param> /// <returns>Временную метку, соответствующую более позднему времени</returns> private string GetLastTimePlayed(string timestamp) { if (LastMatchPlayed != null) { return(timestamp.ToUtc() > LastMatchPlayed.ToUtc() ? timestamp : LastMatchPlayed); } return(timestamp); }
public void CorrectlyCalculateLastMatchPlayed_WhenAdded() { var stat = new LastMatchPlayed(); InitializeStat(stat); stat.Get(_dict); Assert.AreEqual((string)_dict["lastMatchPlayed"], _dateTime2.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'")); }
protected bool Equals(PlayerStat other) { return(TotalMatchesPlayed == other.TotalMatchesPlayed && TotalMatchesWon == other.TotalMatchesWon && string.Equals(FavoriteServer, other.FavoriteServer) && UniqueServers == other.UniqueServers && string.Equals(FavoriteGameMode, other.FavoriteGameMode) && AverageScoreboardPercent == other.AverageScoreboardPercent && MaximumMatchesPerDay == other.MaximumMatchesPerDay && AverageMatchesPerDay == other.AverageMatchesPerDay && LastMatchPlayed.Equals(other.LastMatchPlayed) && KillToDeathRatio == other.KillToDeathRatio); }
public override int GetHashCode() { unchecked { var hashCode = TotalMatchesPlayed; hashCode = (hashCode * 397) ^ TotalMatchesWon; hashCode = (hashCode * 397) ^ (FavoriteServer?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ UniqueServers; hashCode = (hashCode * 397) ^ (FavoriteGameMode?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ AverageScoreboardPercent.GetHashCode(); hashCode = (hashCode * 397) ^ MaximumMatchesPerDay; hashCode = (hashCode * 397) ^ AverageMatchesPerDay.GetHashCode(); hashCode = (hashCode * 397) ^ LastMatchPlayed.GetHashCode(); hashCode = (hashCode * 397) ^ KillToDeathRatio.GetHashCode(); return(hashCode); } }