本文整理汇总了C#中PlayerType.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerType.ToList方法的具体用法?C# PlayerType.ToList怎么用?C# PlayerType.ToList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerType
的用法示例。
在下文中一共展示了PlayerType.ToList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testRanking
public void testRanking()
{
ClearAllData();
var playerLogic = (IPlayerManipulations)getInterfaceImplementation(typeof(IPlayerManipulations));
var teamLogic = (ITeamManipulations)getInterfaceImplementation(typeof(ITeamManipulations));
var gameLogic = (IGameManipulations)getInterfaceImplementation(typeof(IGameManipulations));
var matchLogic = (IMatchManipulations)getInterfaceImplementation(typeof(IMatchManipulations));
var rankingLogic = (IRankingSource)getInterfaceImplementation(typeof(IRankingSource));
var players = new PlayerType[20];
for (int i = 0; i < players.Length; i++)
{
players[i] = new PlayerType() { Name = $"test{i}", Mail = $"test{i}", Tag = $"test{i}" };
playerLogic.AddOrUpdatePlayer(players[i]);
}
var game1 = new GameType() { Name = "game1", ParticipantType = ParticipantTypes.All };
gameLogic.AddOrUpdateGame(game1);
for (int i = 0; i < 5; i++)
{
var scores = new List<int>();
for (int j = 0; j < players.Length; j++)
{
scores.Add(j + 1);
}
var match = new SoloMatch()
{
GameID = game1,
Category = MatchCategories.Training,
dateTime = DateTime.Now,
Players = players.ToList(),
Scores = scores
};
matchLogic.AddOrUpdateSoloMatch(match);
}
var rankings = rankingLogic.GetGameRankingsAll(game1, ParticipantTypes.All);
Assert.IsTrue(rankings.Count == players.Length, $" - getGameRankingsAll, expected count = {players.Length}, was: {rankings.Count}");
var rank = rankings.Where(r => r.Player == players[0]).FirstOrDefault();
Assert.IsNotNull(rank, $" - getGameRankingsAll does not return correct players in rankings");
Assert.IsTrue(rank.Ranking == Ranks.Novice, $" - getGameRankingsAll, \"Novice\" expected, was \"{rank.Ranking}\"");
rank = rankings.Where(r => r.Player == players[5]).FirstOrDefault();
Assert.IsNotNull(rank, $" - getGameRankingsAll does not return correct players in rankings");
Assert.IsTrue(rank.Ranking == Ranks.Competent, $" - getGameRankingsAll, \"Competent\" expected, was \"{rank.Ranking}\"");
rank = rankings.Where(r => r.Player == players[14]).FirstOrDefault();
Assert.IsNotNull(rank, $" - getGameRankingsAll does not return correct players in rankings");
Assert.IsTrue(rank.Ranking == Ranks.Advanced, $" - getGameRankingsAll, \"Advanced\" expected, was \"{rank.Ranking}\"");
rank = rankings.Where(r => r.Player == players[19]).FirstOrDefault();
Assert.IsNotNull(rank, $" - getGameRankingsAll does not return correct players in rankings");
Assert.IsTrue(rank.Ranking == Ranks.Elite, $" - getGameRankingsAll, \"Elite\" expected, was \"{rank.Ranking}\"");
}