public void StandardFaceCardValueIsCorrectlyDeserialized() { //Arrange CardDeckConfiguration configuration; int faceCardValue = 10; //Act configuration = new CardDeckConfigurationProvider().GetRules(); //Assert if (configuration.FaceCardValue != faceCardValue) { string errorMessage = $"The value acquired for the face card value is wrong! Excepted value is: {faceCardValue}. Acquired value is: {configuration.FaceCardValue}"; Assert.Fail(errorMessage); } }
public void StandardSmallestValueOfNumericalCardsIsCorrectlyDeserialized() { //Arrange CardDeckConfiguration configuration; int smallestValueOfNumericalCards = 2; //Act configuration = new CardDeckConfigurationProvider().GetRules(); //Assert if (configuration.SmallestValueOfNumericalCards != smallestValueOfNumericalCards) { string errorMessage = $"The value acquired for the smallest value of numerical cards is wrong! Excepted value is: {smallestValueOfNumericalCards}. Acquired value is: {configuration.SmallestValueOfNumericalCards}"; Assert.Fail(errorMessage); } }
public void StandardNumberOfNumericalCardsInASuitIsCorrectlyDeserialized() { //Arrange CardDeckConfiguration configuration; int numberOfNumericalCardsInASuit = 9; //Act configuration = new CardDeckConfigurationProvider().GetRules(); //Assert if (configuration.NumberOfNumericalCardsInASuit != numberOfNumericalCardsInASuit) { string errorMessage = $"The value acquired for the number of numerical cards in a suit is wrong! Excepted value is: {numberOfNumericalCardsInASuit}. Acquired value is: {configuration.NumberOfNumericalCardsInASuit}"; Assert.Fail(errorMessage); } }
public void CardDeckHasCorrectNumberOfCards() { //Arrange CardDeckConfiguration configuration = new CardDeckConfigurationProvider().GetRules(); //by default it is 13x4 = 52 int numberOfExpectedCards = configuration.NumberOfCardsInASuit * configuration.CardSuits.Count; ICardDeck cardDeck; //Act cardDeck = new CardDeck(); //Assert if (cardDeck.Cards.Count != numberOfExpectedCards) { string errorMessage = $"Created card deck does not have expected number of cards. Expected number is {numberOfExpectedCards}. Actual number of cards is {cardDeck.Cards.Count}"; Assert.Fail(errorMessage); } }
public void CardDeckHasCorrectSuits() { //Arrange CardDeckConfiguration configuration = new CardDeckConfigurationProvider().GetRules(); //by default four suits: Clubs, Diamonds, Hearts, Spades List <ECardSuitTypes> expectedCardSuits = configuration.CardSuits; ICardDeck cardDeck; //Act cardDeck = new CardDeck(); List <ECardSuitTypes> suitTypes = GetCardSuitTypesFromDeck(cardDeck); //Assert if (suitTypes.Count != expectedCardSuits.Count && expectedCardSuits.Any(t => !suitTypes.Contains(t))) { string errorMessage = "Created card deck does not contain all expected suit types!"; Assert.Fail(errorMessage); } }
public void CardSuitTypesIsCorrectlyDeserialized() { //Arrange CardDeckConfiguration configuration; ECardSuitTypes[] cardSuitTypes = { ECardSuitTypes.Clubs, ECardSuitTypes.Diamonds, ECardSuitTypes.Hearts, ECardSuitTypes.Spades }; //Act configuration = new CardDeckConfigurationProvider().GetRules(); //Assert if (configuration.CardSuits.Count != cardSuitTypes.Length && !cardSuitTypes.All(t => configuration.CardSuits.Contains(t))) { string errorMessage = "Expected card suit types could not ne acquired from the configuration file!"; Assert.Fail(errorMessage); } }
public AceCard(ECardSuitTypes cardSuitType) : base(11, cardSuitType, ECardType.Ace) { CardDeckConfiguration config = new CardDeckConfigurationProvider().GetRules(); _value = config.DefaultAceValue; }