本文整理汇总了C#中Player.HasBlackJack方法的典型用法代码示例。如果您正苦于以下问题:C# Player.HasBlackJack方法的具体用法?C# Player.HasBlackJack怎么用?C# Player.HasBlackJack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.HasBlackJack方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HasBlackJack_BlackJack_ReturnsTrue
public void HasBlackJack_BlackJack_ReturnsTrue()
{
var player = new Player("Shannon", 1.0);
player.Hand.Add(new Player.LiveCard(new Card("Spade", 1), true));
player.Hand.Add(new Player.LiveCard(new Card("Heart", 11)));
player.Hand.GetTotal().Should().Be(21);
player.HasBlackJack().Should().BeTrue();
}
示例2: HasBlackJack_WithTwentyOneNoFaceCards_ReturnsTrue
public void HasBlackJack_WithTwentyOneNoFaceCards_ReturnsTrue()
{
var player = new Player("Shannon", 1.0);
player.Hand.Add(new Player.LiveCard(new Card("Spade", 9), true));
player.Hand.Add(new Player.LiveCard(new Card("Spade", 10)));
player.Hand.Add(new Player.LiveCard(new Card("Spade", 2)));
player.Hand.GetTotal().Should().Be(21);
player.HasBlackJack().Should().BeTrue();
}
示例3: HasBlackJack_23FaceValue_ReturnsFalse
public void HasBlackJack_23FaceValue_ReturnsFalse()
{
var player = new Player("Shannon", 1.0);
player.Hand.Add(new Player.LiveCard(new Card("Spade", 3), true));
player.Hand.Add(new Player.LiveCard(new Card("Heart", 11)));
player.Hand.Add(new Player.LiveCard(new Card("Club", 11)));
player.Hand.GetTotal().Should().Be(23);
player.HasBlackJack().Should().BeFalse();
}
示例4: HasBlackJack_FourAces_ReturnsFalse
public void HasBlackJack_FourAces_ReturnsFalse()
{
var player = new Player("Shannon", 1.0);
player.Hand.Add(new Player.LiveCard(new Card("Ace", 1), true));
player.Hand.Add(new Player.LiveCard(new Card("Heart", 1)));
player.Hand.Add(new Player.LiveCard(new Card("Club", 1)));
player.Hand.Add(new Player.LiveCard(new Card("Spade", 1)));
player.Hand.GetTotal().Should().Be(14);
player.HasBlackJack().Should().BeFalse();
}
示例5: HasBlackJack_WithNoHand_ReturnsFalse
public void HasBlackJack_WithNoHand_ReturnsFalse()
{
var player = new Player("Shannon", 1.0);
player.HasBlackJack().Should().BeFalse();
}
示例6: GetHandTotalTest
public void GetHandTotalTest()
{
Player p = new Player(1, 2, null);
p.AddCard(new BlackJackCard(Suite.Clubs, 9));
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Ace));
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Ace));
Assert.AreEqual(21, p.GetHandTotal());
bool pure = true;
Assert.IsTrue(p.HasBlackJack(out pure));
Assert.IsFalse(pure);
p = new Player(1, 2, null);
p.AddCard(new BlackJackCard(Suite.Clubs, 5));
p.AddCard(new BlackJackCard(Suite.Clubs, 7));
p.AddCard(new BlackJackCard(Suite.Clubs, 9));
Assert.AreEqual(21, p.GetHandTotal());
pure = true;
Assert.IsTrue(p.HasBlackJack(out pure));
Assert.IsFalse(pure);
p = new Player(1, 2, null);
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Ace));
p.AddCard(new BlackJackCard(Suite.Clubs, 6));
Assert.AreEqual(17, p.GetHandTotal());
pure = true;
Assert.IsFalse(p.HasBlackJack(out pure));
Assert.IsFalse(pure);
p = new Player(1, 2, null);
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Ace));
p.AddCard(new BlackJackCard(Suite.Clubs, 7));
Assert.AreEqual(18, p.GetHandTotal());
pure = true;
Assert.IsFalse(p.HasBlackJack(out pure));
Assert.IsFalse(pure);
p = new Player(1, 2, null);
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Ace));
p.AddCard(new BlackJackCard(Suite.Clubs, 8));
Assert.AreEqual(19, p.GetHandTotal());
pure = true;
Assert.IsFalse(p.HasBlackJack(out pure));
Assert.IsFalse(pure);
p = new Player(1, 2, null);
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Ace));
p.AddCard(new BlackJackCard(Suite.Clubs, 9));
Assert.AreEqual(20, p.GetHandTotal());
pure = true;
Assert.IsFalse(p.HasBlackJack(out pure));
Assert.IsFalse(pure);
p = new Player(1, 2, null);
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Ace));
p.AddCard(new BlackJackCard(Suite.Clubs, 10));
Assert.AreEqual(21, p.GetHandTotal());
pure = false;
Assert.IsTrue(p.HasBlackJack(out pure));
Assert.IsTrue(pure);
p = new Player(1, 2, null);
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Ace));
p.AddCard(new BlackJackCard(Suite.Clubs, 11));
Assert.AreEqual(21, p.GetHandTotal());
pure = false;
Assert.IsTrue(p.HasBlackJack(out pure));
Assert.IsTrue(pure);
p = new Player(1, 2, null);
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Ace));
p.AddCard(new BlackJackCard(Suite.Clubs, Card.King));
Assert.AreEqual(21, p.GetHandTotal());
pure = false;
Assert.IsTrue(p.HasBlackJack(out pure));
Assert.IsTrue(pure);
p = new Player(1, 2, null);
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Ace));
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Queen));
Assert.AreEqual(21, p.GetHandTotal());
pure = false;
Assert.IsTrue(p.HasBlackJack(out pure));
Assert.IsTrue(pure);
p = new Player(1, 2, null);
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Ace));
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Jack));
Assert.AreEqual(21, p.GetHandTotal());
pure = false;
Assert.IsTrue(p.HasBlackJack(out pure));
Assert.IsTrue(pure);
p = new Player(1, 2, null);
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Ace));
p.AddCard(new BlackJackCard(Suite.Clubs, Card.Ace));
p.AddCard(new BlackJackCard(Suite.Clubs, 11));
Assert.AreEqual(12, p.GetHandTotal());
pure = true;
Assert.IsFalse(p.HasBlackJack(out pure));
Assert.IsFalse(pure);
//.........这里部分代码省略.........
示例7: HasBlackJackTest
public void HasBlackJackTest()
{
//BlackJack scenario
var p = new Player(0, 500, null);
p.AddCard(new BlackJackCard(Suite.Hearts, Card.Ace));
p.AddCard(new BlackJackCard(Suite.Clubs, 10));
bool pure = false;
Assert.IsTrue(p.HasBlackJack(out pure));
Assert.IsTrue(pure);
p = new Player(0, 500, null);
p.AddCard(new BlackJackCard(Suite.Hearts, 9));
p.AddCard(new BlackJackCard(Suite.Clubs, 10));
pure = false;
Assert.IsFalse(p.HasBlackJack(out pure));
p.AddCard(new BlackJackCard(Suite.Clubs, 2));
pure = false;
Assert.IsTrue(p.HasBlackJack(out pure));
Assert.IsFalse(pure);
//Non-BlackJack scenario
p = new Player(0, 500, null);
p.AddCard(new BlackJackCard(Suite.Hearts, 10));
p.AddCard(new BlackJackCard(Suite.Clubs, 10));
pure = false;
Assert.IsFalse(p.HasBlackJack(out pure));
Assert.IsFalse(pure);
p.AddCard(new BlackJackCard(Suite.Clubs, 2));
pure = false;
Assert.IsFalse(p.HasBlackJack(out pure));
Assert.IsFalse(pure);
//Split scenario
//DoubleDown scenario
}