public void AllowDelete() { var movie = new Movie(Session, "1"); var item = movie.AddItem(MovieItemFormat.DVD, 10); Andrew.DoRent(new RentInfo(item)); Session.CommitChanges(); Assert.IsFalse(movie.AllowDelete); }
public void Rent_And_ReturnMovie() { var rent = Andrew.DoRent(new RentInfo(Avatar)).Rents[0]; Assert.IsFalse(Avatar.IsAvailableForRent); Assert.IsTrue(rent.Active); rent.Return(); Assert.IsFalse(rent.Active); Assert.IsTrue(Avatar.IsAvailableForRent); }
public void RentOn_And_DateReturned() { VideoRentDateTime.AddDays(-2); var rent = Andrew.DoRent(new RentInfo(Avatar)).Rents[0]; Assert.IsNull(rent.ReturnedOn); VideoRentDateTime.AddDays(2); rent.Return(); Assert.AreEqual(VideoRentDateTime.Now.Date, rent.ReturnedOn.Value.Date); Assert.AreEqual(VideoRentDateTime.Now.AddDays(-2).Date, rent.RentedOn.Date); }
public void CustomerIsDebter() { var antonReceipt = Anton.DoRent(new RentInfo(Postal, 1)); VideoRentDateTime.AddDays(5); Andrew.DoRent(new RentInfo(Avatar, 3)); Session.CommitChanges(); Assert.IsTrue(Anton.IsDebter); Assert.IsFalse(Andrew.IsDebter); Anton.ReturnRent(antonReceipt.Rents[0]); Session.CommitChanges(); Assert.IsFalse(Anton.IsDebter); }
public void TryDeleteItemWasInRent() { var item = Avatar.AddItem(); var receipt = Andrew.DoRent(new RentInfo(item)); VideoRentDateTime.AddDays(3); Andrew.ReturnRents(receipt.Rents); SessionHelper.CommitSession(Session, null); if (item.AllowDelete) { item.Delete(); } SessionHelper.CommitSession(Session, null); }
public void RentStatus() { var rent = Andrew.DoRent(new RentInfo(Avatar)).Rents[0]; var avatarItem = rent.Item; Assert.IsTrue(rent.Active); Assert.AreEqual(MovieItemStatus.Rented, avatarItem.Status); rent.Return(); Assert.IsFalse(rent.Active); Assert.AreEqual(MovieItemStatus.Active, avatarItem.Status); var newRent = Anton.DoRent(new RentInfo(avatarItem)).Rents[0]; Assert.IsTrue(newRent.Active); Assert.AreEqual(MovieItemStatus.Rented, avatarItem.Status); Assert.IsFalse(rent.Active); }