本文整理汇总了C#中Hand.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Hand.ToString方法的具体用法?C# Hand.ToString怎么用?C# Hand.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hand
的用法示例。
在下文中一共展示了Hand.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToStingShoulReturnStringValue
public void ToStingShoulReturnStringValue()
{
var cards = new List<ICard>() { new Card(CardFace.Ace, CardSuit.Clubs) };
var hand = new Hand(cards);
Assert.IsInstanceOfType(hand.ToString(), typeof(string));
}
示例2: HandToStringWithCorrectCards
public void HandToStringWithCorrectCards()
{
IList<ICard> cards = new List<ICard>() { new Card(CardFace.Queen, CardSuit.Hearts), new Card(CardFace.King, CardSuit.Hearts) };
var hand = new Hand(cards);
var expected = "Queen of Hearts ♥ / King of Hearts ♥";
Assert.AreEqual(expected, hand.ToString());
}
示例3: ToString_StringEmptyHand
[TestMethod] // ♣
public void ToString_StringEmptyHand() // ♦
{ // ♥
IHand hand = new Hand(new List<ICard>()); // ♠
string actual = hand.ToString();
Assert.AreEqual(String.Empty, actual, "Tostring() method of Hand not implemented currenctly.");
}
示例4: HandToStringShouldReturnACorrectStringValue
public void HandToStringShouldReturnACorrectStringValue()
{
IList<ICard> cards = new List<ICard>() { new Card(CardFace.Ace, CardSuit.Spades), new Card(CardFace.Queen, CardSuit.Hearts) };
var hand = new Hand(cards);
var expected = "Ace of Spades / Queen of Hearts";
Assert.AreEqual(expected, hand.ToString());
}
示例5: TestToStringWithoutCards
public void TestToStringWithoutCards()
{
IList<ICard> hand = new List<ICard>();
Hand currentHand = new Hand(hand);
Assert.AreEqual(string.Empty, currentHand.ToString());
}
示例6: ToString_HandOfOneCard
public void ToString_HandOfOneCard()
{
ICard jackOfDiamonds = new Card(CardFace.Jack, CardSuit.Diamonds);
IHand hand = new Hand(new List<ICard>() { jackOfDiamonds });
string actual = hand.ToString();
Assert.AreEqual("J♦", actual, "Tostring() method of Hand not implemented currenctly.");
}
示例7: ToStringWithSameCard
public void ToStringWithSameCard()
{
var hand = new Hand(new List<ICard>() {
new Card(CardFace.Ace, CardSuit.Spades),
new Card(CardFace.Ace, CardSuit.Spades)
});
Assert.AreEqual("A♠ A♠", hand.ToString());
}
示例8: TestHandEmptyToString
public void TestHandEmptyToString()
{
IList<ICard> cards = new List<ICard>();
Hand hand = new Hand(cards);
string expected = string.Empty;
string actual = hand.ToString();
Assert.AreEqual(expected, actual);
}
示例9: CreatingAHandWithValidListOfCardsShouldReturnCorrectToString
public void CreatingAHandWithValidListOfCardsShouldReturnCorrectToString()
{
var cardA = new Card(CardFace.King, CardSuit.Spades);
var cardB = new Card(CardFace.Three, CardSuit.Clubs);
var cards = new List<ICard>() { cardA, cardB };
var hand = new Hand(cards);
var expectedValue = cardA.ToString() + Environment.NewLine + cardB.ToString();
Assert.AreEqual(expectedValue, hand.ToString());
}
示例10: HandToStringTestOneCard
public void HandToStringTestOneCard()
{
Hand hand = new Hand(new List<ICard>()
{
new Card(CardFace.Nine, CardSuit.Hearts)
});
string expected = "9♥";
string actual = hand.ToString();
Assert.AreEqual(expected, actual);
}
示例11: TestToStringWithOneCard
public void TestToStringWithOneCard()
{
IList<ICard> hand = new List<ICard>
{
new Card(CardFace.Ten, CardSuit.Spades)
};
Hand currentHand = new Hand(hand);
Assert.AreEqual("10♠", currentHand.ToString());
}
示例12: ToStringWithFiveCard
public void ToStringWithFiveCard()
{
var hand = new Hand(new List<ICard>() {
new Card(CardFace.Ace, CardSuit.Spades),
new Card(CardFace.King, CardSuit.Clubs),
new Card(CardFace.Queen, CardSuit.Hearts),
new Card(CardFace.Jack, CardSuit.Diamonds),
new Card(CardFace.Ten, CardSuit.Spades),
});
Assert.AreEqual("A♠ K♣ Q♥ J♦ 10♠", hand.ToString());
}
示例13: HandToString
public void HandToString()
{
Card testCard = new Card(CardFace.Ace, CardSuit.Clubs);
Card testCard2 = new Card(CardFace.Eight, CardSuit.Diamonds);
IList<ICard> cards = new List<ICard>();
cards.Add(testCard);
cards.Add(testCard2);
Hand testHand = new Hand(cards);
Assert.AreEqual("Ace Clubs & Eight Diamonds", testHand.ToString());
}
示例14: HandToStringReturnCorrectly
public void HandToStringReturnCorrectly()
{
var cards = new List<ICard>
{
new Card(CardFace.Ace, CardSuit.Clubs),
new Card(CardFace.Four, CardSuit.Hearts),
};
var hand = new Hand(cards);
Assert.AreEqual("Ace of Clubs | Four of Hearts", hand.ToString());
}
示例15: HandToStringTestThreeCards
public void HandToStringTestThreeCards()
{
Hand hand = new Hand(new List<ICard>()
{
new Card(CardFace.Two, CardSuit.Hearts),
new Card(CardFace.Three, CardSuit.Diamonds),
new Card(CardFace.Four, CardSuit.Spades)
});
string expected = "2♥ 3♦ 4♠";
string actual = hand.ToString();
Assert.AreEqual(expected, actual);
}