Ejemplo n.º 1
0
        public void GetError(string calculation, int expectedCode, string expectedValue)
        {
            var sut  = new CalcEngineController();
            var resp = sut.Get(calculation);

            Assert.AreEqual(expectedCode, ((BadRequestObjectResult)resp).StatusCode);
            Assert.AreEqual(expectedValue, ((BadRequestObjectResult)resp).Value);
        }
Ejemplo n.º 2
0
        public void GetSuccessPrecsision(string calculation, int?precision, int expectedCode, double expectedValue)
        {
            ActionResult resp = null;
            var          sut  = new CalcEngineController();

            if (precision.HasValue)
            {
                resp = sut.Get(calculation, precision);
            }
            else
            {
                resp = sut.Get(calculation);
            }

            Assert.AreEqual(expectedCode, ((OkObjectResult)resp).StatusCode);
            Assert.AreEqual(expectedValue, ((OkObjectResult)resp).Value);
        }
Ejemplo n.º 3
0
        public void GetSuccess(string calculation, int expectedCode, double expectedValue)
        {
            var sut  = new CalcEngineController();
            var resp = sut.Get(calculation);

            Assert.AreEqual(expectedCode, ((OkObjectResult)resp).StatusCode);
            Assert.AreEqual(expectedValue, ((OkObjectResult)resp).Value);
        }