Ejemplo n.º 1
0
        public IActionResult Score([FromBody] Stream stream)
        {
            int score  = 0;
            int result = _service.AddScore(stream.Input, score);

            if (result != -1)
            {
                return(Ok(result));
            }
            else
            {
                return(BadRequest("invalid input"));
            }
        }
Ejemplo n.º 2
0
        public void CheckInputFromFakeData1()
        {
            for (int i = 0; i < _list.Count; i++)
            {
                int returnScore = _service.AddScore(_list[i], 0);
                switch (i)
                {
                case 0:
                    Assert.AreEqual(1, returnScore);
                    break;

                case 1:
                    Assert.AreEqual(6, returnScore);
                    break;

                case 2:
                    Assert.AreEqual(5, returnScore);
                    break;

                case 3:
                    Assert.AreEqual(16, returnScore);
                    break;

                case 4:
                    Assert.AreEqual(1, returnScore);
                    break;

                case 5:
                    Assert.AreEqual(9, returnScore);
                    break;

                case 6:
                    Assert.AreEqual(9, returnScore);
                    break;

                case 7:
                    Assert.AreEqual(3, returnScore);
                    break;

                default:
                    break;
                }
            }
        }