コード例 #1
0
        public void Check_GetScoreFromFakeData()
        {
            var score0 = _streamService.getScore(0);
            var score1 = _streamService.getScore(1);
            var score2 = _streamService.getScore(2);
            var score3 = _streamService.getScore(3);
            var score4 = _streamService.getScore(4);
            var score5 = _streamService.getScore(5);
            var score6 = _streamService.getScore(6);
            var score7 = _streamService.getScore(7);
            var score8 = _streamService.getScore(8);

            Assert.IsNotNull(score0);
            Assert.IsNotNull(score1);
            Assert.IsNotNull(score2);
            Assert.IsNotNull(score3);
            Assert.IsNotNull(score4);
            Assert.IsNotNull(score5);
            Assert.IsNotNull(score6);
            Assert.IsNotNull(score7);
            Assert.IsNotNull(score8);

            Assert.AreEqual(1, score0);
            Assert.AreEqual(6, score1);
            Assert.AreEqual(5, score2);
            Assert.AreEqual(16, score3);
            Assert.AreEqual(1, score4);
            Assert.AreEqual(9, score5);
            Assert.AreEqual(9, score6);
            Assert.AreEqual(3, score7);
            Assert.AreEqual(10800, score8);
        }
コード例 #2
0
        public HttpResponseMessage GetScoreAtIndex(int id)
        {
            int score = _streamService.getScore(id);

            if (score == -1)
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }

            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);

            response.Content = new StringContent(score.ToString());
            return(response);
        }