public void GetPriceByDateRaiseExceptionTest() { ValidityControl.ClearListDates(); try { ValidityControl.GetPriceByDate(new DateTime(2015, 8, 17, 0, 0, 0)); Assert.Fail("Não lançou a exception"); } catch (NotFoundDateControl e) { Assert.IsTrue(true); } }
public void GetPriceByDateTest() { DateTime initialDateControl = new DateTime(2015, 8, 16, 0, 0, 0); DateTime finalDateControl = new DateTime(2015, 11, 15, 23, 59, 59); double price = 5; ValidityControl.AddDateControl(price, initialDateControl, finalDateControl); initialDateControl = new DateTime(2015, 8, 18, 0, 0, 0); finalDateControl = new DateTime(2015, 11, 15, 23, 59, 59); price = 9; ValidityControl.AddDateControl(price, initialDateControl, finalDateControl); double returnedPrice = ValidityControl.GetPriceByDate(new DateTime(2015, 8, 17, 0, 0, 0)); Assert.AreEqual(5, returnedPrice); }