public void CalculateWinners_TwoItems_ManyRaiderBids() { //Arrange RankConfiguration raider = new RankConfiguration("Raider", null, 1); configuration.Ranks = new[] { raider }; Auction auction = raid.NewAuction(2); AuctionBid bid1 = auction.AddBid("Blace", 103, raider); AuctionBid bid2 = auction.AddBid("Khovet", 75, raider); auction.AddBid("Glororhan", 69, raider); auction.AddBid("Mowron", 69, raider); auction.AddBid("kalvin", 67, raider); auction.AddBid("GALVANIZED", 55, raider); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(2); completedAuction.AssertWinner(bid1, 70); completedAuction.AssertWinner(bid2, 70); }
public void CalculateWinners_TwoItemsAndCustomRanks_ManyBids() { //Arrange RankConfiguration raiderConfig = new RankConfiguration("Raider", null, 1); RankConfiguration boxConfig = new RankConfiguration("Box", 50, 3); RankConfiguration altConfig = new RankConfiguration("Alt", 10, 1); RankConfiguration memberConfig = new RankConfiguration("Member", 10, 1); configuration.Ranks = new[] { raiderConfig, boxConfig, altConfig, memberConfig }; Auction auction = raid.NewAuction(2); AuctionBid bid1 = auction.AddBid("Galvanized", 26, raiderConfig); AuctionBid bid2 = auction.AddBid("Barogue", 14, altConfig); auction.AddBid("Autobahn", 10, raiderConfig); auction.AddBid("Khaldraks", 10, memberConfig); auction.AddBid("Windforce", 5, altConfig); auction.AddBid("Glororhan", 5, raiderConfig); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(2); completedAuction.AssertWinner(bid1, 11); completedAuction.AssertWinner(bid2, 11); }
public void CalculateWinners_OneItem_OneBid() { //Arrange Auction auction = raid.NewAuction(1); AuctionBid mainBid = auction.AddBid("main", 50, main); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(1); completedAuction.AssertWinner(mainBid, 1); }
public void CalculateWinners_TwoItems_BoxesOverMain() { //Arrange Auction auction = raid.NewAuction(2); AuctionBid mainBid = auction.AddBid("main", 35, main); AuctionBid boxBid1 = auction.AddBid("box1", 51, box); AuctionBid boxBid2 = auction.AddBid("box2", 80, box); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(2); completedAuction.AssertWinner(boxBid1, 108); completedAuction.AssertWinner(boxBid2, 108); }
public void CalculateWinners_TwoItems_TwoBidsBid() { //Arrange Auction auction = raid.NewAuction(2); AuctionBid bid1 = auction.AddBid("main", 104, main); AuctionBid bid2 = auction.AddBid("main2", 45, main); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(2); completedAuction.AssertWinner(bid1, 1); completedAuction.AssertWinner(bid2, 1); }
public void CalculateWinners_TwoItems_SingleBid() { //Arrange Auction auction = raid.NewAuction(2); AuctionBid mainBid = auction.AddBid("main", 104, main); auction.Bids.AddOrUpdate(mainBid); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(1); completedAuction.AssertWinner(mainBid, 1); }
public void CalculateWinners_OneItem_TieBids() { //Arrange Auction auction = raid.NewAuction(1); auction.AddBid("main", 10, main); auction.AddBid("alt", 10, alt); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(1); Assert.AreEqual(10, completedAuction.WinningBids.First().Price, "Winner should pay 10."); }
public void CalculateWinners_OneItem_ThreeBidsOutOfOrder() { //Arrange Auction auction = raid.NewAuction(1); auction.AddBid("main2", 17, main); auction.AddBid("alt", 104, alt); AuctionBid mainBid = auction.AddBid("main", 50, main); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(1); completedAuction.AssertWinner(mainBid, 26); }
public void CalculateWinners_OneItem_TieBidsOverCap() { //Arrange Auction auction = raid.NewAuction(1); AuctionBid mainBid = auction.AddBid("main", 126, main); auction.AddBid("alt", 126, alt); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(1); completedAuction.AssertWinner(mainBid, 26); }
public void CalculateWinners_TwoItems_ThreeBids() { //Arrange Auction auction = raid.NewAuction(2); AuctionBid mainBid = auction.AddBid("main", 50, main); auction.AddBid("main2", 17, main); AuctionBid altBid = auction.AddBid("alt", 104, alt); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(2); completedAuction.AssertWinner(mainBid, 18); completedAuction.AssertWinner(altBid, 18); }
public void CalculateWinners_ThreeItem_Boxes() { //Arrange Auction auction = raid.NewAuction(3); AuctionBid main1Bid = auction.AddBid("main1", 93, main); AuctionBid box1Bid = auction.AddBid("box1", 101, box); AuctionBid box2Bid = auction.AddBid("box2", 60, box); auction.AddBid("main2", 30, main); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(3); completedAuction.AssertWinner(main1Bid, 31); completedAuction.AssertWinner(box1Bid, 93); completedAuction.AssertWinner(box2Bid, 93); }
public void CalculateWinners_TwoItems_BigBoxBid() { //Arrange Auction auction = raid.NewAuction(2); AuctionBid mainBid = auction.AddBid("main", 104, main); AuctionBid boxBid1 = auction.AddBid("box1", 300, box); auction.AddBid("box2", 250, box); auction.AddBid("alt", 54, alt); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(2); completedAuction.AssertWinner(mainBid, 101); completedAuction.AssertWinner(boxBid1, 753); }
public void CalculateWinners_ThreeItems_SecondPlaceTie() { //Arrange Auction auction = raid.NewAuction(3); AuctionBid bid1 = auction.AddBid("first", 67, main); AuctionBid bid2 = auction.AddBid("second1", 41, main); AuctionBid bid3 = auction.AddBid("second2", 41, main); auction.AddBid("alt", 35, alt); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(3); completedAuction.AssertWinner(bid1, 26); completedAuction.AssertWinner(bid2, 26); completedAuction.AssertWinner(bid3, 26); }
public void CalculateWinners_TwoItems_SecondPlaceTie() { //Arrange Auction auction = raid.NewAuction(2); AuctionBid mainBid = auction.AddBid("first", 15, main); auction.AddBid("second1", 5, main); auction.AddBid("second2", 5, main); auction.AddBid("alt", 2, alt); //Act CompletedAuction completedAuction = target.CalculateWinners(auction); //Assert completedAuction.AssertNumberOfWinners(2); completedAuction.AssertWinner(mainBid, 5); WinningBid winner2 = completedAuction.WinningBids[1]; Assert.IsTrue(winner2.Bid.CharacterName.StartsWith("second"), "Winner2 should be a second"); Assert.AreEqual(5, winner2.Price, "second should pay 5"); }