private static void LogIn() { helper = new SwgohHelper(new UserSettings() { Username = testUsername, Password = testPassword, Debug = "true" }); helper.Login(); }
public void SetupTheLogin() { helper = new SwgohHelper(new UserSettings() { Username = testUsername, Password = testPassword, Debug = "true" }); helper.Login(); }
public void FetchAllPlayerDataFromCrinolo() { var data = SwgohHelper.fetchAllUnitsForPlayerFromCrinolo("999531726"); TestContext.Write(data); //var units = JsonConvert.DeserializeObject<UnitDict>(data); //Assert.AreEqual(units["MAGMATROOPER"].unit.Player,"Rhialto The Marvelous"); }
public void DownloadAbilityIconsFromSwgohGG() { var abilities = JsonConvert.DeserializeObject <List <Ability> >(SwgohHelper.fetchAllAbilitiesFromSwgohGGApi()); string uri; foreach (var item in abilities) { uri = "https://swgoh.gg" + item.Image; var imageName = item.BaseId + ".png"; using (WebClient client = new WebClient()) { client.DownloadFile(new Uri(uri), @"c:\temp-images\" + imageName); } } }
public void DownloadIconsFromSwgohGG() { var gear = JsonConvert.DeserializeObject <List <Gear> >(SwgohHelper.fetchAllGearFromSwgohGGApi()); string uri; foreach (var item in gear) { uri = "https://swgoh.gg" + item.Image; var imageName = item.BaseId; using (WebClient client = new WebClient()) { client.DownloadFile(new Uri(uri), @"f:\temp-images\" + imageName + ".png"); } } }
private SwgohHelper Authenticate() { SwgohHelper helper; if (!_cache.TryGetValue(HelperEntry, out helper)) { helper = new SwgohHelper(new UserSettings() { Username = _testUsername, Password = _testPassword, Debug = "true" }); helper.Login(); SetCacheValue(HelperEntry, sourceHelp, helper); } return(helper); }
private List <List <UnitWithStat> > GetPlayerOneAndTwo(List <string> codesToRequest) { List <UnitWithStat> PlayerOne; List <UnitWithStat> PlayerTwo; string PlayerOneCode = codesToRequest[0]; string PlayerTwoCode = codesToRequest[1]; //Check if PlayerOne is in the cache if (GetCacheValue(PlayerOneCode, sourceCrinolo, out PlayerOne)) { codesToRequest.Remove(PlayerOneCode); } //Check if PlayerTwo is in the cache if (GetCacheValue(PlayerTwoCode, sourceCrinolo, out PlayerTwo)) { codesToRequest.Remove(PlayerTwoCode); } if (codesToRequest.Count > 0) { foreach (var code in codesToRequest) { if (PlayerOne == null) { PlayerOne = SwgohHelper.fetchListOfUnitsForPlayerFromCrinolo(code.ToString()); SetCacheValue(code, sourceCrinolo, PlayerOne); } else if (PlayerTwo == null) { PlayerTwo = SwgohHelper.fetchListOfUnitsForPlayerFromCrinolo(code.ToString()); SetCacheValue(code, sourceCrinolo, PlayerTwo); } } } return(new List <List <UnitWithStat> >() { PlayerOne, PlayerTwo }); }
private async void AuthenticateAsync() { SwgohHelper helper; if (_cache.TryGetValue(HelperEntry, out helper)) { return; } else { await Task.Run(() => { helper = new SwgohHelper(new UserSettings() { Username = _testUsername, Password = _testPassword, Debug = "true" }); helper.Login(); SetCacheValue(HelperEntry, sourceHelp, helper); } ); } }
public void FetchListOfAllPlayerDataFromCrinolo() { var units = SwgohHelper.fetchListOfUnitsForPlayerFromCrinolo("999531726"); Assert.AreEqual(units[0].NameKey, "Magmatrooper"); }
public void fetchAllAbilitiesFromGgAndDeSerializeThem() { var abilities = JsonConvert.DeserializeObject <List <Ability> >(SwgohHelper.fetchAllAbilitiesFromSwgohGGApi()); Assert.AreEqual(abilities[0].CharacterBaseId, "GRIEVOUS"); }
public void fetchSpecificGearFromGgAndDeSerializeIt() { var gear = JsonConvert.DeserializeObject <Gear>(SwgohHelper.fetchSpecificGearFromSwgohGGApi("126")); Assert.AreEqual(gear.Cost, 4350); }
public List <Ability> GetAllAbilities() { return(JsonConvert.DeserializeObject <List <Ability> >(SwgohHelper.fetchAllAbilitiesFromSwgohGGApi())); }
public List <Gear> GetAllGear() { return(JsonConvert.DeserializeObject <List <Gear> >(SwgohHelper.fetchAllGearFromSwgohGGApi())); }
public Gear GetSpecificGear(string code) { return(JsonConvert.DeserializeObject <Gear>(SwgohHelper.fetchSpecificGearFromSwgohGGApi(code))); }