コード例 #1
0
        public void HandOfCards_ConvertsStringToListOfPlayingCard()
        {
            var hand     = "2C TD 3S 7H AC";
            var expected = new List <PlayingCard> {
                new PlayingCard('2', 'C'),
                new PlayingCard('3', 'S'),
                new PlayingCard('7', 'H'),
                new PlayingCard('T', 'D'),
                new PlayingCard('A', 'C')
            }.OrderByDescending(o => o.CardValue).ToList();

            var result = new HandOfCards(hand).Cards;

            Assert.AreEqual(5, result.Count);
            Assert.AreEqual(expected[0].CardValue, result[0].CardValue);
            Assert.AreEqual(expected[0].CardSuit, result[0].CardSuit);
            Assert.AreEqual(expected[1].CardValue, result[1].CardValue);
            Assert.AreEqual(expected[1].CardSuit, result[1].CardSuit);
            Assert.AreEqual(expected[2].CardValue, result[2].CardValue);
            Assert.AreEqual(expected[2].CardSuit, result[2].CardSuit);
            Assert.AreEqual(expected[3].CardValue, result[3].CardValue);
            Assert.AreEqual(expected[3].CardSuit, result[3].CardSuit);
            Assert.AreEqual(expected[4].CardValue, result[4].CardValue);
            Assert.AreEqual(expected[4].CardSuit, result[4].CardSuit);
        }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: kufena/AdventOfCode2020
        public void Test1()
        {
            HandOfCards hoc = new HandOfCards(new int[] { });
            int         res = hoc.PopTop();

            Assert.AreEqual(-1, res);
        }
コード例 #3
0
ファイル: UnitTest1.cs プロジェクト: kufena/AdventOfCode2020
        public void Test5()
        {
            HandOfCards hoc = new HandOfCards(new int[] { 9, 8, 7 });

            hoc.AddToBottom(987);
            int res = hoc.PopTop();

            Assert.AreEqual(9, res);
        }
コード例 #4
0
ファイル: Player.cs プロジェクト: frotein/Aether
 public void Start()
 {
     hand        = GetComponent <HandOfCards>();
     hand.player = this;
     hand.cam    = cam;
     hand.gridM  = gridM;
     health      = 20;
     connection  = 10;
     aether      = 5;
 }
コード例 #5
0
ファイル: UnitTest1.cs プロジェクト: kufena/AdventOfCode2020
        public void Test3()
        {
            HandOfCards hoc  = new HandOfCards(new int[] { 9, 8, 7 });
            int         res1 = hoc.PopTop();
            int         res2 = hoc.PopTop();
            int         res3 = hoc.PopTop();
            int         res4 = hoc.PopTop();

            Assert.AreEqual(9, res1);
            Assert.AreEqual(8, res2);
            Assert.AreEqual(7, res3);
            Assert.AreEqual(-1, res4);
        }
コード例 #6
0
ファイル: UnitTest1.cs プロジェクト: kufena/AdventOfCode2020
        public void Test4()
        {
            HandOfCards hoc = new HandOfCards(new int[] { 9, 8, 7 });
            int         c   = hoc.Count;

            Assert.AreEqual(3, c);
            hoc.AddToBottom(11);
            c = hoc.Count;
            Assert.AreEqual(4, c);
            hoc.PopTop();
            hoc.PopTop();
            Assert.AreEqual(2, hoc.Count);
            hoc.PopTop();
            hoc.PopTop();
            Assert.AreEqual(0, hoc.Count);
        }
コード例 #7
0
ファイル: PokerPlayer.cs プロジェクト: jschaffner/PokerHand
 public PokerPlayer(string name, string hand)
 {
     Name        = name;
     HandOfCards = new HandOfCards(hand);
 }
コード例 #8
0
 // Start is called before the first frame update
 void Start()
 {
     _handOfCards = handOfCards.GetComponent <HandOfCards>();
     _handOfCards.initializeHand(handSize);
 }
コード例 #9
0
        public void HandOfCards_SetsPokerHandRank(string hand, PokerHandRank expectedPokerHandRank)
        {
            var handOfCards = new HandOfCards(hand);

            Assert.AreEqual(expectedPokerHandRank, handOfCards.PokerHandRank);
        }