示例#1
0
        public void TestTimersNotSold()
        {
            List<string> receivedEvents = new List<string>();

            AuctionItem item = new AuctionItem(1, "Chair", 100, 1000);
            Auction auction = new Auction();
            auction.AddItem(item);

            Auctioneer auctioneer = new Auctioneer(auction, 500, 500, 500);

            auctioneer.CallFirst += delegate(string message)
            {
                receivedEvents.Add(message);
            };

            auctioneer.CallSecond += delegate(string message)
            {
                receivedEvents.Add(message);
            };

            auctioneer.CallThird += delegate(string message)
            {
                receivedEvents.Add(message);
            };

            auction.Start(auctioneer);

            Thread.Sleep(2000);

            Assert.AreEqual("First!", receivedEvents[0]);
            Assert.AreEqual("Second!", receivedEvents[1]);
            bool containsThird = receivedEvents[2].Contains("Third!");
            Assert.IsTrue(containsThird);
        }
        public PlaceBidsController()
        {
            auctionStarted = false;
            auction = new Auction();

            AuctionItem item1 = new AuctionItem(1, "Chair", 2000, 2000);
            auction.AddItem(item1);
            AuctionItem item2 = new AuctionItem(2, "Car", 50000, 70000);
            auction.AddItem(item2);
            AuctionItem item3 = new AuctionItem(3, "Couch", 400, 400);
            auction.AddItem(item3);

            auctioneer = new Auctioneer(auction, 10000, 5000, 3000);

            auction.NewRound += newRound;
            auction.NewBidAccepted += newBidAccepted;
            auctioneer.CallFirst += callFirst;
            auctioneer.CallSecond += callSecond;
            auctioneer.CallThird += callThird;
        }