public void TestYearLowBoundary() { const int minYear = 1950; AutoMobile car = new AutoMobile(id, model, minYear, prix); Assert.AreEqual(minYear, car.Year, 0, "Year loop lower boundary incorrect"); }
public void TestYearHighBoundary() { const int maxYear = 2020; AutoMobile car = new AutoMobile(id, model, maxYear, prix); Assert.AreEqual(maxYear, car.Year, 0, "Year loop High boundary incorrect"); }
public void TestDiscountHighBoundary() //also provide a check of correct calculation of price when a discount is provided { const int maxDiscount = 20; const float expected = 800000; AutoMobile car = new AutoMobile(id, model, yearcar, prix, maxDiscount); Assert.AreEqual(expected, car.Price, 0, "Discount High boundary incorrect"); }
public void TestDiscountLowBoundary() { const int minDiscount = 0; AutoMobile car = new AutoMobile(id, model, yearcar, prix, minDiscount); Assert.AreEqual(prix, car.Price, 0, "Discount lower boundary incorrect"); }
public void TestConstructorAutomobile() { AutoMobile car = new AutoMobile(id, model, yearcar, prix); Assert.AreEqual(id, car.IdNumber, "Id incorrect"); Assert.AreEqual(model, car.Make, "Make incorrect"); Assert.AreEqual(yearcar, car.Year, "Year incorrect"); Assert.AreEqual(prix, car.Price, "Price incorrect"); }
public void TestAutoMoblileOverloadDiscount() { const float testDiscount = 5; const float expected = 950000; AutoMobile car = new AutoMobile(id, model, yearcar, prix, testDiscount); Assert.AreEqual(expected, car.Price, 0.001, "discount calculation incorrect"); Assert.AreEqual(id, car.IdNumber, "Id incorrect"); Assert.AreEqual(model, car.Make, "Make incorrect"); Assert.AreEqual(yearcar, car.Year, "Year incorrect"); }
public void TestDiscountLowBound() { const float negativeDiscount = -1; try { AutoMobile car = new AutoMobile(id, model, yearcar, prix, negativeDiscount); } catch (System.ArgumentOutOfRangeException e) { // Assert StringAssert.Contains(e.Message, AutoMobile.DiscountOutofRange); return; } Assert.Fail("The expected exception was not thrown."); }
public void TestYearHigh() { const int toHighTestYear = 2021; try { AutoMobile car = new AutoMobile(id, model, toHighTestYear, prix); } catch (System.ArgumentOutOfRangeException e) { // Assert StringAssert.Contains(e.Message, AutoMobile.FailYear); return; } Assert.Fail("The expected exception was not thrown."); }