当前位置: 首页>>代码示例>>C#>>正文


C# Deck.Find方法代码示例

本文整理汇总了C#中Deck.Find方法的典型用法代码示例。如果您正苦于以下问题:C# Deck.Find方法的具体用法?C# Deck.Find怎么用?C# Deck.Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Deck的用法示例。


在下文中一共展示了Deck.Find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToString_WitheFormat_ReturnsExpectedCardRepresentation

        public void ToString_WitheFormat_ReturnsExpectedCardRepresentation()
        {
            Deck deck = new Deck();
            Card aceOfHearts = deck.Find(SuitName.Heart, ValueName.Ace);
            Card aceOfDiamonds = deck.Find(SuitName.Diamond, ValueName.Ace);
            Card aceOfClubs = deck.Find(SuitName.Club, ValueName.Ace);
            Card aceOfSpades = deck.Find(SuitName.Spade, ValueName.Ace);

            Assert.AreEqual("Ah", aceOfHearts.ToString("e"));
            Assert.AreEqual("Ad", aceOfDiamonds.ToString("e"));
            Assert.AreEqual("Ac", aceOfClubs.ToString("e"));
            Assert.AreEqual("As", aceOfSpades.ToString("e"));
        }
开发者ID:GrimeyCoder,项目名称:CommonGames,代码行数:13,代码来源:CardTests.cs

示例2: ToString_WithFormat_ReturnsExpectedCardRepresentation

        public void ToString_WithFormat_ReturnsExpectedCardRepresentation()
        {
            Deck deck = new Deck();
            Card aceOfHearts = deck.Find(SuitName.Heart, ValueName.Ace);
            Card aceOfDiamonds = deck.Find(SuitName.Diamond, ValueName.Ace);
            Card aceOfClubs = deck.Find(SuitName.Club, ValueName.Ace);
            Card aceOfSpades = deck.Find(SuitName.Spade, ValueName.Ace);

            Assert.AreEqual("A" + Convert.ToChar(3), aceOfHearts.ToString("s"));
            Assert.AreEqual("A" + Convert.ToChar(4), aceOfDiamonds.ToString("s"));
            Assert.AreEqual("A" + Convert.ToChar(5), aceOfClubs.ToString("s"));
            Assert.AreEqual("A" + Convert.ToChar(6), aceOfSpades.ToString("s"));
        }
开发者ID:GrimeyCoder,项目名称:CommonGames,代码行数:13,代码来源:CardTests.cs

示例3: GetHandDescription_WithRoyalFlush_ReturnsCorrectDescription

        public void GetHandDescription_WithRoyalFlush_ReturnsCorrectDescription()
        {
            Deck deck = new Deck();
            Card[] holeCards =
                new []
                    {
                        deck.Find(SuitName.Heart, ValueName.Ace),
                        deck.Find(SuitName.Heart, ValueName.King)
                    };

            Card[] boardCards =
                new[]
                    {
                        deck.Find(SuitName.Heart, ValueName.Queen),
                        deck.Find(SuitName.Heart, ValueName.Jack),
                        deck.Find(SuitName.Heart, ValueName.Ten),
                        deck.Find(SuitName.Club, ValueName.Two),
                        deck.Find(SuitName.Spade, ValueName.Five)
                    };

            HandEvaluatorWrapper handEvaluator = new HandEvaluatorWrapper();
            string handDescription = handEvaluator.GetHandDescription(holeCards, boardCards);
            Assert.IsFalse(string.IsNullOrEmpty(handDescription));
            Assert.AreEqual("Straight Flush (Hearts) with Ace high", handDescription);
        }
开发者ID:GrimeyCoder,项目名称:CommonGames,代码行数:25,代码来源:HandEvaluatorWrapperTests.cs


注:本文中的Deck.Find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。