Ejemplo n.º 1
0
        public void ShouldBeBad()
        {
            var mathSoft = new MathSoft {
                InitialValue = 100, Month = 10, TotalValue = (decimal)105.10
            };
            var mathCore = new Mock <IMathCore>();

            mathCore.Setup(x => x.CalculateInterest(null))
            .Returns(mathSoft.TotalValue);

            var controller = new CalculaJurosController(mathCore.Object);

            var result = controller.CalculaJurosPost(null);

            Assert.True(((StatusCodeResult)result).StatusCode == 400);
        }
Ejemplo n.º 2
0
        public void ShouldBeWrongValue()
        {
            var mathSoft = new MathSoft {
                InitialValue = 100, Month = 5, TotalValue = (decimal)105.10
            };
            var mathCore = new Mock <IMathCore>();

            mathCore.Setup(x => x.CalculateInterest(mathSoft))
            .Returns(mathSoft.TotalValue);

            var controller = new CalculaJurosController(mathCore.Object);

            var result = controller.CalculaJurosPost(mathSoft);

            var okObjectResult = Assert.IsType <OkObjectResult>(result);

            Assert.NotEqual((decimal)110.10, okObjectResult.Value);
        }