public void RegisterBid_ShouldThrowExceptionDueCurrency() { BiddingBroker broker = new BiddingBroker(InitMockedDb()); Person goodPerson = GetGoodPerson(broker); Auction goodAuction = GetGoodAuction(broker); Auction registeredAuction = broker.RegisterAuction(goodPerson, goodAuction); Assert.NotNull(registeredAuction); Assert.NotEqual(0, registeredAuction.IdAuction); Person bidder = GetGoodPerson2(broker); double bad_value = goodAuction.StartValue - 1; Bid bid = new Bid() { Currency = broker.GetCurrencyByName("eur"), Date = DateTime.Now, Value = bad_value, Auction = goodAuction, }; Assert.ThrowsAny <Exception>(() => broker.RegisterBid(bidder, bid, goodAuction)); }
public Auction GetGoodAuction(BiddingBroker broker) { Product goodProduct = GetGoodProduct(broker); double startValue = 123.3; Currency currency = broker.GetCurrencyByName("ron"); DateTime startDate = DateTime.Now; DateTime endDate = DateTime.Now.AddDays(1); Auction goodAuction = new Auction() { StartDate = startDate, EndDate = endDate, StartValue = startValue }; goodAuction.Product = goodProduct; goodAuction.Currency = currency; return(goodAuction); }
public void GetCurrencyByName_ShouldNotThrow(string name) { BiddingBroker broker = new BiddingBroker(InitMockedDb()); Assert.ThrowsAny <Exception>(() => broker.GetCurrencyByName(name)); }