public Rank GetRank(long steamId) { var accountId = SteamIdDecoder.ToAccountId(steamId); var rank = Rank.NotRanked; try { var rankId = GetRank(accountId, myCsgoClient).Result; rank = (Rank)rankId; } catch (AggregateException e) { var innerExceptions = e.InnerExceptions; if (innerExceptions.Any(x => x is GameCoordinatorException)) { throw innerExceptions.Single(x => x is GameCoordinatorException); } if (innerExceptions.Any(x => x is TimeoutException)) { var timeoutMessage = innerExceptions.Single(x => x is TimeoutException).Message; myLogger.LogWarning(timeoutMessage); throw new GameCoordinatorException(timeoutMessage); } throw; } return(rank); }
public void ToAccountId_ValidSteamId_ReturnsCorrectAccountId(long steamId, uint expectedAccountId) { var accountId = SteamIdDecoder.ToAccountId(steamId); Assert.Equal(expectedAccountId, accountId); }