public async Task <ActionResult <string> > GetMatchData([FromForm] string playerId, [FromForm] int warshipId) { if (string.IsNullOrEmpty(playerId)) { return(BadRequest()); } MatchmakerResponse matcherResponse = await matchmakerFacadeService.GetMatchDataAsync(playerId, warshipId); return(matcherResponse.SerializeToBase64String()); }
public async Task GetMatchData_PlayerIdIsNormal_OkResult() { //Arrange var stubResponse = new MatchmakerResponse(); var matchmakerFacadeStub = new Mock <IMatchmakerFacadeService>(); matchmakerFacadeStub.Setup(s => s.GetMatchDataAsync(It.IsNotNull <string>(), It.IsAny <int>())).ReturnsAsync(stubResponse); var controller = new PlayerController(new Mock <IBattleRoyaleQueueSingletonService>().Object, matchmakerFacadeStub.Object); //Act var result = await controller.GetMatchData("NotNullPlayerId", 0); //Assert Assert.AreEqual(stubResponse.SerializeToBase64String(), result.Value); }