Ejemplo n.º 1
0
        public void Should_calculate_rate_on_initial_value_correctly()
        {
            //Arrange
            var controller   = new CalculatorController(_logger.Object);
            var initialValue = _faker.Random.Decimal(100, 10000);
            var period       = _faker.Random.Int(1, 120);

            //Act
            var response = controller.GetCalculator(initialValue, period);

            //Assert
            var expectedValue = Math.Round(initialValue * Convert.ToDecimal(Math.Pow((double)(1 + RateConstants.RateBase), period)), 2, MidpointRounding.ToZero);

            Assert.Equal(expectedValue, response);

            //Dispose
            controller.Dispose();
        }