private AuctionCommand ProcessCloseEvent() { if (Snapshot.State == SniperState.Winning) { Snapshot = Snapshot.Won(); } else { Snapshot = Snapshot.Lost(); } return(AuctionCommand.None()); }
private AuctionCommand ProcessPriceEvent(int currentPrice, int increment, string bidder) { if (Bidder == bidder) { Snapshot = Snapshot.Winning(currentPrice); return(AuctionCommand.None()); } int newBid = currentPrice + increment; if (newBid > StopPrice) { Snapshot = Snapshot.Losing(currentPrice); return(AuctionCommand.None()); } else { Snapshot = Snapshot.Bidding(currentPrice, newBid); return(AuctionCommand.Bid(newBid)); } }
private AuctionCommand ProcessUnknownEvent() { Snapshot = Snapshot.Failed(); return(AuctionCommand.None()); }
public AuctionSniper(string bidder, int stopPrice) { Bidder = bidder; StopPrice = stopPrice; Snapshot = SniperSnapshot.Joining(); }