public void ShouldParseCardsWithoutException(JArray collectible, JArray nonCollectible) { var parser = ContainerResolver.Resolve <IHearthstoneJsonCardParser>(); parser.Parse(collectible); parser.Parse(nonCollectible); }
public void ShouldFindAllEnumValues(JArray collectible, JArray nonCollectible) { var parser = ContainerResolver.Resolve <IHearthstoneJsonCardParser>(); var collectibleCards = parser.Parse(collectible); var nonCollectibleCards = parser.Parse(nonCollectible); foreach (var card in collectibleCards.Union(nonCollectibleCards)) { if (card.Class != null) { card.Class.Should().NotBe(CardClass.INVALID); } if (card.Classes != null) { card.Classes.Should().NotContain(CardClass.INVALID); } if (card.Faction != null) { card.Faction.Should().NotBe(Faction.INVALID); } if (card.MultiClassGroup != null) { card.MultiClassGroup.Should().NotBe(MultiClassGroup.INVALID); } if (card.Requirements != null) { card.Requirements.Should().NotContainKey(PlayReq.INVALID); } if (card.Race != null) { card.Race.Should().NotBe(Race.INVALID); } if (card.Rarity.HasValue) { card.Rarity.Should().NotBe(Rarity.INVALID); } if (card.Set.HasValue) { card.Set.Should().NotBe(CardSet.INVALID); } if (card.Type.HasValue) { card.Type.Should().NotBe(CardType.INVALID); } } }
public void ShouldParseDeck1() { var parser = ContainerResolver.Resolve <IDeckPlainTextParser>(); var deck = parser.ParseDeck(TestDataProvider.GetStringContent($@"TestData\Decks\Deck1.txt")); deck.Name.Should().NotBeNullOrWhiteSpace(); deck.Class.Should().NotBeNullOrWhiteSpace(); deck.Format.Should().NotBeNullOrWhiteSpace(); deck.Cards.Should().NotBeNull(); deck.Cards.Sum(x => x.Value).Should().Be(30); }
public void ShouldFindAllCardsInCollectibles(JArray collectible, JArray nonCollectible) { var parser = ContainerResolver.Resolve <IHearthstoneJsonCardParser>(); var cardDtos = parser.Parse(collectible); var deckParser = ContainerResolver.Resolve <IDeckPlainTextParser>(); var deck = deckParser.ParseDeck(TestDataProvider.GetStringContent($@"TestData\Decks\Deck1.txt")); var mappedCards = deck.Cards.Select(x => cardDtos.FirstOrDefault(y => y.Name == x.Key)); mappedCards.Should().NotContainNulls(); }