Exemple #1
0
        public void GetTopBooties_ReturnsGetTopBootiesResponse()
        {
            var expectedUsername   = "******";
            var minimumPointAmount = 1000;
            var minimumTotal       = 10;

            var bootiesResponse = _seClient.GetTopPoints().GetAwaiter().GetResult();

            Assert.IsTrue(bootiesResponse.Users.Any(bu => bu.Username.Contains(expectedUsername)), $"The list of usernames did not contain the expected value: {expectedUsername} ");
            Assert.IsTrue(bootiesResponse.Users.FirstOrDefault(bu => bu.Username.Contains(expectedUsername))?.Points > minimumPointAmount, $"The user's points did not meet the minimum expected value: {minimumPointAmount} ");
            Assert.IsTrue(bootiesResponse._total > minimumTotal, $"The Total: {bootiesResponse._total} did not meet the minimum expected value: {minimumTotal}");
        }
        public async Task <ActionResult> GetTopPoints()
        {
            GetTopBootiesResponse topPoints;

            try
            {
                topPoints = await _seClient.GetTopPoints();
            }
            catch (Exception e)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, Json(e)));
            }

            return(StatusCode((int)HttpStatusCode.OK, Json(topPoints)));
        }