コード例 #1
0
        public async Task ModuleUpdateMatchStatistic()
        {
            await StatisticStorage.UpdateServer(Server1.GetIndex(), Server1);

            await Module.ProcessRequest(CreateRequest(
                                            JsonConvert.SerializeObject(Match1),
                                            $"/servers/{Match1.HostServer.Id}/matches/{Match1.EndTime.ToUtcFormat()}",
                                            HttpMethodEnum.Put));

            var response = await Module.ProcessRequest(CreateRequest(
                                                           JsonConvert.SerializeObject(Match2),
                                                           $"/servers/{Match1.HostServer.Id}/matches/{Match1.EndTime.ToUtcFormat()}",
                                                           HttpMethodEnum.Put));

            var combined = Match2;

            combined.HostServer = Match1.HostServer;
            combined.EndTime    = Match1.EndTime;

            response.Response.Should().Be(new HttpResponse(HttpStatusCode.OK));

            var result = await StatisticStorage.GetMatch(Match1.GetIndex());

            result.ShouldBeEquivalentTo(combined,
                                        options => options
                                        .Excluding(info => info.Id)
                                        .Excluding(info => info.Scoreboard));
        }
コード例 #2
0
        public async Task ModuleAddNewMatchStatistic()
        {
            await StatisticStorage.UpdateServer(Server1.GetIndex(), Server1);

            var response = await Module.ProcessRequest(CreateRequest(
                                                           JsonConvert.SerializeObject(Match1),
                                                           $"/servers/{Match1.HostServer.Id}/matches/{Match1.EndTime.ToUtcFormat()}",
                                                           HttpMethodEnum.Put));

            response.Response.Should().Be(new HttpResponse(HttpStatusCode.OK));

            var result = await StatisticStorage.GetMatch(Match1.GetIndex());

            result.Should().Be(Match1);
        }