public void GetAllCards() { ArtifactClient client = new ArtifactClient(); List <Card> allCards = client.GetAllCards(); Assert.IsNotNull(allCards); }
private void InitClient() { if (m_client == null) { m_client = new ArtifactClient(); m_client.GetAllCards(); } }
public MainWindow() { Logger.OutputInfo($"Program Start - Artifact API {VERSION}"); InitializeComponent(); this.Title += $" {VERSION}"; Closed += OnProgramClosed; Loaded += OnViewLoaded; outputBox.TextChanged += OnOutputPasted; tb_javascriptCopy.GotFocus += OnHaveGotFocus; t_invalidCode.Visibility = Visibility.Collapsed; m_client = new ArtifactClient(); //Load since bug with not loading cards m_client.GetAllCards(); }
/// <summary> /// Gets 5 random hero names /// </summary> /// <returns></returns> private string[] GetRandomHeroNames() { InitClient(); if (m_allHeroNames == null) { List <Models.Card> cards = m_client.GetAllCards(); List <Models.Card> heroes = cards.Where(x => x.Type == ArtifactAPI.Enums.CardType.Hero).ToList(); m_allHeroNames = heroes.Select(x => x.Names.English).ToList(); } List <string> randomHeroes = new List <string>(); for (int i = 0; i < 5; i++) { int rndIndex = m_rnd.Next(0, m_allHeroNames.Count); randomHeroes.Add(m_allHeroNames[rndIndex]); } return(randomHeroes.ToArray()); }