public async Task <PlayerMatchStatisticResponseDto> AddAsync([FromBody] PlayerMatchStatisticRequestDto matchStatisticDto)
        {
            var model    = mapper.Map <PlayerMatchStatisticModel>(matchStatisticDto);
            var response = await matchStatisticService.AddAsync(model);

            return(mapper.Map <PlayerMatchStatisticResponseDto>(response));
        }
예제 #2
0
        public virtual async Task AddPlayerMatchStatisticAsync(PlayerMatchStatisticRequestDto matchStatistic)
        {
            var url   = $"{rocketApiUrl}/api/playermatchstatistic";
            var token = await authClient.ObtainAccessTokenAsync();

            var request = new RestRequest(Method.POST);

            request.AddJsonBody(JsonConvert.SerializeObject(matchStatistic));
            request.AddHeader("Authorization", $"Bearer {token}");

            await http.ExecuteRequestAsync(url, request);
        }
        public async Task AddPlayerMatchStatisticAsync_HappyPath()
        {
            // Arrange
            var fakeStat = new PlayerMatchStatisticRequestDto()
            {
                PlayerMatchId = Guid.NewGuid(), StatType = "Goals", Value = 8
            };

            // Act
            await rocketClient.AddPlayerMatchStatisticAsync(fakeStat);

            // Assert
            mockHttpClient.Verify(Clients => Clients.ExecuteRequestAsync($"{fakeUrl}/api/playermatchstatistic", It.IsAny <RestRequest>()), Times.Once);
        }