public void EndAuctionTwoTimes_ShouldEndAuction() { AuctionService auction = InstanceHelper.GetAuctionService(null); auction.EndAuction(auction.Auction.PersonOfferor); Assert.True(auction.HadEnded); Assert.ThrowsAny <Exception>(() => auction.EndAuction(auction.Auction.PersonOfferor)); }
public void EndAuction_ShouldEndAuction() { AuctionService auction = InstanceHelper.GetAuctionService(null); auction.EndAuction(auction.Auction.PersonOfferor); Assert.True(auction.HadEnded); Assert.False(auction.IsActive); }
/// <summary> /// Ends the auction. /// </summary> /// <param name="person">The person.</param> /// <param name="auction">The auction.</param> public void EndAuction(Person person, Auction auction) { IAuctionTable auctionTable = this.tablesProvider.GetAuctionTable(); IPersonOfferorTable personOfferorTable = this.tablesProvider.GetPersonOfferorTable(); try { PersonOfferor offeror = personOfferorTable.FetchPersonOfferorByPerson(person); AuctionService auctionService = new AuctionService(auction); auctionService.EndAuction(offeror); auctionTable.UpdateAuction(auctionService.Auction); Log.Info("auction ended!"); } catch (Exception e) { Log.Info("EndAuction :" + e.Message); throw e; } }