Exemplo n.º 1
0
        public void AfterClientSendingGetRecentMatchesRequest()
        {
            var match      = Test.CreateGameMatchStats();
            var count      = 3;
            var timestamps = new DateTime[count];

            for (var i = 0; i < count; i++)
            {
                timestamps[i] = new DateTime(2017, 3, i + 1, 10, 10, 0);
                client.SendRequest().PutMatchStats(match, Test.Server1Endpoint, timestamps[i]);
            }
            var neededCount = 2;
            var matches     = new GameMatchResult[neededCount];

            for (var i = 0; i < neededCount; i++)
            {
                matches[i] = new GameMatchResult(Test.Server1Endpoint, timestamps[i + neededCount - 1])
                {
                    Results = match
                }
            }
            ;
            var response = client.GetRecentMatches(neededCount);

            server.ClearDatabaseAndCache();
            var result = JsonConvert.DeserializeObject <GameMatchResult[]>(response.Message);

            result.ShouldAllBeEquivalentTo(matches);
        }