Example #1
0
        /// <summary>
        /// Adds the calculate interest service.
        /// </summary>
        /// <param name="services">Services.</param>
        /// <param name="configuration">Configuration.</param>
        public static void AddCalculateInterest(this IServiceCollection services, IConfiguration configuration)
        {
            var options = new CalculateInterestOptions();
            var section = configuration.GetSection("CalculateInterest");

            section.Bind(options);

            var calculateInterestService = new CalculateInterestService(options);

            services.AddScoped <ICalculateInterestService>(_ => calculateInterestService);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:SoftplanCalc.Api.Tests.CalculateInterestServiceUnitTest"/> class.
        /// </summary>
        public CalculateInterestServiceUnitTest()
        {
            var configuration = TestHelper.GetIConfiguration(Directory.GetCurrentDirectory());

            var options = new CalculateInterestOptions();
            var section = configuration.GetSection("CalculateInterest");

            section.Bind(options);

            _calculateInterestService = new CalculateInterestService(options);
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:SoftplanCalc.Api.Tests.CalculateInterestControllerUnitTest"/> class.
        /// </summary>
        public CalculateInterestControllerUnitTest()
        {
            var configuration = TestHelper.GetIConfiguration(Directory.GetCurrentDirectory());

            var options = new CalculateInterestOptions();
            var section = configuration.GetSection("CalculateInterest");

            section.Bind(options);

            var calculateInsterestService = new CalculateInterestService(options);
            var logger = new BaseLogger();

            _calculateInterestController = new CalculateInterestController(logger, calculateInsterestService);
        }