public CardSuit(ECardSuitTypes suitType) { _suitType = suitType; _cardDeckConfiguration = new CardDeckConfigurationProvider().GetRules(); _cards = new List <Card>(); CreateSuit(); }
public void NumericalCardCanBeCreated() { //Act int value = 7; ECardSuitTypes cardSuitType = ECardSuitTypes.Spades; ECardType cardType = ECardType.Numerical; Card testCard; //Arrange testCard = new Card(value, cardSuitType, cardType); //Assert if (testCard.Value != value) { string errorMessage = $"Card is created with the wrong value. Expected card value is {value}. Actual card value is {testCard.Value}"; Assert.Fail(errorMessage); } if (testCard.CardSuit != cardSuitType) { string errorMessage = $"Card is created with the wrong card suit type. Expected card suit type is {cardSuitType}. Actual card suit type is {testCard.CardSuit}"; Assert.Fail(errorMessage); } if (testCard.CardType != cardType) { string errorMessage = $"Card is created with the wrong card type. Expected card type is {cardType}. Actual card suit type is {testCard.CardType}"; Assert.Fail(errorMessage); } }
public void FaceCardQueenCanBeCreated() { //Act int value = 10; ECardSuitTypes cardSuitType = ECardSuitTypes.Clubs; ECardType cardType = ECardType.Queen; Card testCard; //Arrange testCard = new FaceCard(cardSuitType, cardType); //Assert if (testCard.Value != value) { string errorMessage = $"Card is created with the wrong value. Expected card value is {value}. Actual card value is {testCard.Value}"; Assert.Fail(errorMessage); } if (testCard.CardSuit != cardSuitType) { string errorMessage = $"Card is created with the wrong card suit type. Expected card suit type is {cardSuitType}. Actual card suit type is {testCard.CardSuit}"; Assert.Fail(errorMessage); } if (testCard.CardType != cardType) { string errorMessage = $"Card is created with the wrong card type. Expected card type is {cardType}. Actual card suit type is {testCard.CardType}"; Assert.Fail(errorMessage); } }
public void FaceCardWithModifiedValueCanBeCreated() { //Act int value = 5; ECardSuitTypes cardSuitType = ECardSuitTypes.Diamonds; ECardType cardType = ECardType.King; Card testCard; //Arrange testCard = new Card(value, cardSuitType, cardType); //Assert if (testCard.Value != value) { string errorMessage = $"Card is created with the wrong value. Expected card value is {value}. Actual card value is {testCard.Value}"; Assert.Fail(errorMessage); } if (testCard.CardSuit != cardSuitType) { string errorMessage = $"Card is created with the wrong card suit type. Expected card suit type is {cardSuitType}. Actual card suit type is {testCard.CardSuit}"; Assert.Fail(errorMessage); } if (testCard.CardType != cardType) { string errorMessage = $"Card is created with the wrong card type. Expected card type is {cardType}. Actual card suit type is {testCard.CardType}"; Assert.Fail(errorMessage); } }
public Card GetNumericalCard(int value, ECardSuitTypes cardSuitType) { if (value <= 10) { return(new Card(value, cardSuitType, ECardType.Numerical)); } throw new ArgumentException(); }
public FaceCard(ECardSuitTypes cardSuitType, ECardType cardType) : base(10, cardSuitType, cardType) { if (cardType != ECardType.Jack && cardType != ECardType.Queen && cardType != ECardType.King) { throw new ArgumentException($@"Card type for face card must be either: 1) {ECardType.Jack} 2) {ECardType.Queen} 3) {ECardType.King}", nameof(cardType)); } CardDeckConfiguration config = new CardDeckConfigurationProvider().GetRules(); _value = config.FaceCardValue; }
public AceCard(ECardSuitTypes cardSuitType) : base(11, cardSuitType, ECardType.Ace) { CardDeckConfiguration config = new CardDeckConfigurationProvider().GetRules(); _value = config.DefaultAceValue; }
public NumericalCard(int value, ECardSuitTypes cardSuitType) : base(value, cardSuitType, ECardType.Numerical) { }
public Card(int value, ECardSuitTypes cardSuitType, ECardType cardType) { _value = value; _cardSuitType = cardSuitType; _cardType = cardType; }
public PlayedCard(int value, ECardSuitTypes cardSuitType, ECardType cardType) : base(value, cardSuitType, cardType) { }