public void TestNightAndPeakSurcharge() { DateTime dateTime = new DateTime(2020, 3, 3, 19, 59, 0); decimal answer = FareManager.CalculateFare(5, 1M, dateTime, new NewYorkRates()); Assert.AreEqual(8.50M, answer); }
public void TestMilesFraction() { DateTime dateTime = new DateTime(2020, 3, 3, 19, 0, 0); decimal answer = FareManager.CalculateFare(1, 1.6M, dateTime, new NewYorkRates()); Assert.AreEqual(7.65M, answer); }
public void TestNoHourSurcharges() { DateTime dateTime = new DateTime(2020, 3, 7, 19, 0, 0); decimal answer = FareManager.CalculateFare(1, 1M, dateTime, new NewYorkRates()); Assert.AreEqual(5.60M, answer); }
public ActionResult <decimal> GetFare([FromBody] Fare fare) { if (fare == null) { return(BadRequest()); } try { return(FareManager.CalculateFare(fare.MinutesAbove6, fare.MilesBelow6, fare.StartTime, new NewYorkRates())); } catch (Exception e) { Console.WriteLine(e); return(new StatusCodeResult((int)HttpStatusCode.InternalServerError)); } }