public void MovieItem_CalcOnOrderPrice() { var newFilms = new MovieCategory(Session); var newFilmsOnDVD = newFilms.GetPrice(MovieItemFormat.DVD); newFilmsOnDVD.LateRentPrice = 4; newFilmsOnDVD.Days1RentPrice = 2; newFilmsOnDVD.Days2RentPrice = 1; Avatar.Category = newFilms; var avatarItem = Avatar.Items[0]; var onOrderPrice = avatarItem.CalcOnOrderPrice(9); Assert.AreEqual(7 * 1 + (9 - 7) * 4, onOrderPrice); onOrderPrice = avatarItem.CalcOnOrderPrice(1); Assert.AreEqual(1 * 2, onOrderPrice); }
public void CreatingAndDeletingPrices() { var category = new MovieCategory(Session); foreach (var format in EnumHelper.GetValues <MovieItemFormat>()) { var price = category.GetPrice(MovieItemFormat.DVD); Assert.IsNotNull(price); } var prices = category.Prices; category.Delete(); foreach (var price in prices) { Assert.IsTrue(price.IsDeleted); } }
public void MovieItem_CalcRentMaxDaysCount() { var newFilms = new MovieCategory(Session); var newFilmsOnDVD = newFilms.GetPrice(MovieItemFormat.DVD); newFilmsOnDVD.LateRentPrice = 1; newFilmsOnDVD.Days1RentPrice = 2; newFilmsOnDVD.Days2RentPrice = 1; Avatar.Category = newFilms; var avatarItem = Avatar.Items[0]; avatarItem.SellingPrice = 2; Assert.AreEqual(0, avatarItem.CalcRentMaxDaysCount()); avatarItem.SellingPrice = 4; Assert.AreEqual(3, avatarItem.CalcRentMaxDaysCount()); avatarItem.SellingPrice = 10; Assert.AreEqual(9, avatarItem.CalcRentMaxDaysCount()); avatarItem.SellingPrice = 10.5m; Assert.AreEqual(10, avatarItem.CalcRentMaxDaysCount()); avatarItem.AvailableForSell = false; Assert.AreEqual(-1, avatarItem.CalcRentMaxDaysCount()); }