public void Mortgage_CalculateMonthlyPayment() { // Arrange const int term = 5; const TermUnits termUnits = TermUnits.Years; const decimal principal = 100000M; const decimal annualPercentInterest = 6.0M; const decimal expectedMonthlyPayment = 1933.28M; var mortgage = new Mortgage { Principal = principal, AnnualPercentInterest = annualPercentInterest, Term = term, TermUnits = termUnits }; // Act decimal monthlyPayment = mortgage.CalculateMonthlyPayment(); // Assert Assert.AreEqual(expectedMonthlyPayment, monthlyPayment); }
// POST api/monthlypayment public decimal Post(Mortgage mortgage) { return mortgage.CalculateMonthlyPayment(); }