public void BuyNowTestException2() { StubUnitOfWork uow = new StubUnitOfWork(); BargainingService service = new BargainingService(uow); Category category = uow.Categories.GetAll().FirstOrDefault(); Lot lot = new Lot() { Id = uow.Lots.GetAll().Count() + 1, Name = "Test Bargaining", StartPrice = 322, CurrPrice = 322, BuyNowPrice = 1337, IsAllowed = true, IsOpen = false, CategoryId = category.Id, Category = category, Description = "zxc" }; uow.Lots.Create(lot); Assert.ThrowsException <ValidationException>(() => service.BuyNow(lot.Id)); }
public void BuyNowTest() { StubUnitOfWork uow = new StubUnitOfWork(); BargainingService service = new BargainingService(uow); Category category = uow.Categories.GetAll().FirstOrDefault(); Lot lot = new Lot() { Id = uow.Lots.GetAll().Count() + 1, Name = "Test Bargaining", StartPrice = 322, CurrPrice = 322, BuyNowPrice = 1337, IsAllowed = true, IsOpen = true, CategoryId = category.Id, Category = category, Description = "zxc" }; uow.Lots.Create(lot); service.BuyNow(lot.Id); lot = uow.Lots.Get(lot.Id); Assert.AreEqual(lot.IsOpen, false); Assert.AreEqual(lot.CurrPrice, lot.BuyNowPrice); }
public void BuyNowTestException1() { StubUnitOfWork uow = new StubUnitOfWork(); BargainingService service = new BargainingService(uow); int id = uow.Lots.GetAll().Count() + 1; Assert.ThrowsException <ItemNotFoundException>(() => service.BuyNow(id)); }