コード例 #1
0
        private AuctionCommand ProcessCloseEvent()
        {
            if (Snapshot.State == SniperState.Winning)
            {
                Snapshot = Snapshot.Won();
            }
            else
            {
                Snapshot = Snapshot.Lost();
            }

            return(AuctionCommand.None());
        }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
 private AuctionCommand ProcessUnknownEvent()
 {
     Snapshot = Snapshot.Failed();
     return(AuctionCommand.None());
 }
コード例 #4
0
 public AuctionSniper(string bidder, int stopPrice)
 {
     Bidder    = bidder;
     StopPrice = stopPrice;
     Snapshot  = SniperSnapshot.Joining();
 }