예제 #1
0
        public void TestGetPlayerRanking_ReturnsOk()
        {
            rankingController = new RankingController(mockRankingService.Object);
            var getPlayerRankingResult = rankingController.GetPlayerRanking(rankingHelper.playerId);

            OkObjectResult result = getPlayerRankingResult as OkObjectResult;

            Assert.NotNull(result);
            Assert.AreEqual(mockRankingService.Object.GetPlayerPoints(rankingHelper.playerId, GameType.ShipsGame), result.Value);
            Assert.AreEqual(200, result.StatusCode);
        }
        public void GetPlayerRanking_ShouldReturnPoints()
        {
            string playerId = "player1";

            _rankingService.GetPlayerPoints(playerId, Common.Models.GameType.KalamburyGame).Returns(1);
            _controller = CreateController();

            ActionResult <int> actionResult = _controller.GetPlayerRanking(playerId);

            Assert.IsInstanceOf <OkObjectResult>(actionResult.Result);
            OkObjectResult okObjectResult = actionResult.Result as OkObjectResult;

            Assert.IsInstanceOf <int>(okObjectResult.Value);
            var model = (int)okObjectResult.Value;

            Assert.IsNotNull(model);
            Assert.AreEqual(1, model);
        }