Beispiel #1
0
        public async Task PutMatchInfo_SavesInfo()
        {
            var endpoint  = "PutServerInfo_SavesInfo";
            var timeStamp = DateTime.UtcNow.Date - TimeSpan.FromDays(3);
            var matchData = new MatchInfoEntry
            {
                Map         = "DM-HelloWorld",
                GameMode    = "TM",
                FragLimit   = 20,
                TimeLimit   = 20,
                TimeElapsed = 12.345678,
                Scoreboard  = new List <ScoreEntry>
                {
                    new ScoreEntry {
                        Name = "Player1", Frags = 20, Kills = 21, Deaths = 3
                    },
                    new ScoreEntry {
                        Name = "Player2", Frags = 2, Kills = 2, Deaths = 21
                    }
                }
            };

            await statistics.PutMatchInfo(endpoint, timeStamp, matchData);

            using (var databaseContext = new DatabaseContext())
            {
                var result =
                    databaseContext.Matches.Find(matchData.Endpoint + timeStamp.ToString(CultureInfo.InvariantCulture));


                result.ShouldBeEquivalentTo(matchData, o =>
                {
                    o.Excluding(x => x.Key);
                    o.Excluding(x => x.Timestamp);
                    o.Excluding(x => x.RecentMatchEntry);
                    return(o);
                });
            }
        }
Beispiel #2
0
 public async Task PutMatchInfo(MatchInfoEntry serverInfoEntry, string endpoint, DateTime timestamp)
 {
     await statistics.PutMatchInfo(endpoint, timestamp, serverInfoEntry);
 }