public void ReadOneSpellCardJSON() { //Read the one spell card json data and generate a list of cards from it, which should contain only one card List <Card> cards = JSONReader.GenerateCardsFromJSON(OneSpellCardJSON); //Ensure the length of this card list is two Assert.AreEqual(1, cards.Count); //Ensure the cards were generated correctly Assert.AreEqual("Small Rock", cards[0].Name); }
/// <summary> /// Parses the cards json data and generates card objects from it /// </summary> private void LoadAllCards() { //Create an empty dictionary to populate with cards _allCards = new Dictionary <int, Card>(); //Read card JSON data and generate a list of cards from it TextAsset cardDataRaw = Resources.Load <TextAsset>("Cards"); List <Card> generatedCards = JSONReader.GenerateCardsFromJSON(cardDataRaw.text); //Read the generated cards into the allCards dictionary foreach (Card c in generatedCards) { _allCards.Add(c.Id, c); } }