public void CheckMortgage_MaturityPeriodNotFoundReturnsNull()
        {
            var options   = new DbContextOptionsBuilder <MortgageDbContext>().UseInMemoryDatabase(databaseName: "MortgageDbTest2").Options;
            var dbContext = new MortgageDbContext(options);

            Seed(dbContext);

            var service = new MortgageService(new MortgageRateRepository(dbContext));

            var res = service.CheckMortgage(0, 99, 0, 0);

            Assert.Null(res);
        }
        public void CheckMortgage_ReturnsNotFeasibleResult_MortgageMoreThanHome()
        {
            var options   = new DbContextOptionsBuilder <MortgageDbContext>().UseInMemoryDatabase(databaseName: "MortgageDbTest4").Options;
            var dbContext = new MortgageDbContext(options);

            Seed(dbContext);

            var service = new MortgageService(new MortgageRateRepository(dbContext));

            var res = service.CheckMortgage(200000, 10, 150000, 160000);

            Assert.NotNull(res);
            Assert.False(res.IsFeasible);
        }
        public void CheckMortgage_IsFeasible()
        {
            var options   = new DbContextOptionsBuilder <MortgageDbContext>().UseInMemoryDatabase(databaseName: "MortgageDbTest5").Options;
            var dbContext = new MortgageDbContext(options);

            Seed(dbContext);

            var service = new MortgageService(new MortgageRateRepository(dbContext));

            var res = service.CheckMortgage(60000, 10, 200000, 250000);

            Assert.NotNull(res);
            Assert.True(res.IsFeasible);
            Assert.True(Math.Abs(1781.75546 - res.MonthlyCost) < 0.00001);
            //Assert.Equal(1781.7554685308316,res.MonthlyCost);
        }