本文整理汇总了C#中Santase.Logic.Cards.Card.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Card.ToString方法的具体用法?C# Card.ToString怎么用?C# Card.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Santase.Logic.Cards.Card
的用法示例。
在下文中一共展示了Card.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartRoundShouldAddToLoggerAndCallBaseMethod
public void StartRoundShouldAddToLoggerAndCallBaseMethod()
{
var logger = new MemoryLogger();
var playerMock = new Mock<IPlayer>();
var playerWithLogger = new PlayerWithLoggerDecorator(playerMock.Object, logger);
var card = new Card(CardSuit.Diamond, CardType.King);
var cards = new List<Card> { card };
var trumpCard = new Card(CardSuit.Club, CardType.Ace);
playerWithLogger.StartRound(cards, trumpCard, 1, 4);
Assert.IsTrue(logger.ToString().Length > 0);
Assert.IsTrue(logger.ToString().Contains(card.ToString()));
Assert.IsTrue(logger.ToString().Contains(trumpCard.ToString()));
playerMock.Verify(x => x.StartRound(cards, trumpCard, 1, 4), Times.Once());
}
示例2: ToStringShouldReturnValidValueWhenPlayCard
public void ToStringShouldReturnValidValueWhenPlayCard()
{
var card = new Card(CardSuit.Club, CardType.Ace);
var playerAction = PlayerAction.PlayCard(card);
var toStringValue = playerAction.ToString();
Assert.IsNotNull(toStringValue);
Assert.IsTrue(toStringValue.Contains("PlayCard"));
Assert.IsTrue(toStringValue.Contains(card.ToString()));
}
示例3: ToStringShouldReturnDifferentValidValueForEachCardCombination
public void ToStringShouldReturnDifferentValidValueForEachCardCombination()
{
var values = new HashSet<string>();
foreach (CardSuit cardSuitValue in Enum.GetValues(typeof(CardSuit)))
{
foreach (CardType cardTypeValue in Enum.GetValues(typeof(CardType)))
{
var card = new Card(cardSuitValue, cardTypeValue);
var cardToString = card.ToString();
Assert.IsFalse(
values.Contains(cardToString),
$"Duplicate string value \"{cardToString}\" for card \"{card}\"");
values.Add(cardToString);
}
}
}