public void RunTests() { HTCPilotStatsSvc statsSvc = new HTCPilotStatsSvc(); AcesHighPilotStats stats = statsSvc.GetPilotStatsMultiThreaded("99MecInf", TourType.MainArenaTour, 76, new ProxySettingsDTO()); HTCPilotScoreSvc scoreSvc = new HTCPilotScoreSvc(); AcesHighPilotScore score = scoreSvc.GetPilotScore("99MecInf", TourType.MainArenaTour, 76, new ProxySettingsDTO()); int i = 0; /* * TourNode tour = TourDefinitions.Instance.GetTourDetails(76, TourType.MainArenaTour); * * Sender httpSender = new Sender(new ProxySettingsDTO()); * StreamReader prototype = File.OpenText("individual_scores.http.txt"); * httpSender.RequestString = "gameid=" + "99MecInf" + "&tour=" + tour.FullyQualifiedTourIdentifier; * httpSender.URLEncodeRequestString(); * httpSender.Initialise(prototype, "http://www.hitechcreations.com/cgi-bin/105score/105score.pl"); * StreamReader response = httpSender.Send(); * * * string PilotVsBuffer = response.ReadToEnd(); * StringReader pilotVsStringReader = new StringReader(PilotVsBuffer); * * // Use the cool sgml reader to 'interpret' the HTML as XML :) very nice! * SgmlReader pilotVsSgmlReader = new SgmlReader(); * pilotVsSgmlReader.DocType = "HTML"; * pilotVsSgmlReader.InputStream = pilotVsStringReader; * statsXmlDoc.Load(pilotVsSgmlReader); * * statsXmlDoc.Save(Console.Out); * statsXmlDoc.Save(@"C:\response.xml"); */ }
public void RunTests() { HTCPilotStatsSvc statsSvc = new HTCPilotStatsSvc(); AcesHighPilotStats stats = statsSvc.GetPilotStatsMultiThreaded("99MecInf", TourType.MainArenaTour, 76, new ProxySettingsDTO()); HTCPilotScoreSvc scoreSvc = new HTCPilotScoreSvc(); AcesHighPilotScore score = scoreSvc.GetPilotScore("99MecInf", TourType.MainArenaTour, 76, new ProxySettingsDTO()); int i = 0; /* TourNode tour = TourDefinitions.Instance.GetTourDetails(76, TourType.MainArenaTour); Sender httpSender = new Sender(new ProxySettingsDTO()); StreamReader prototype = File.OpenText("individual_scores.http.txt"); httpSender.RequestString = "gameid=" + "99MecInf" + "&tour=" + tour.FullyQualifiedTourIdentifier; httpSender.URLEncodeRequestString(); httpSender.Initialise(prototype, "http://www.hitechcreations.com/cgi-bin/105score/105score.pl"); StreamReader response = httpSender.Send(); string PilotVsBuffer = response.ReadToEnd(); StringReader pilotVsStringReader = new StringReader(PilotVsBuffer); // Use the cool sgml reader to 'interpret' the HTML as XML :) very nice! SgmlReader pilotVsSgmlReader = new SgmlReader(); pilotVsSgmlReader.DocType = "HTML"; pilotVsSgmlReader.InputStream = pilotVsStringReader; statsXmlDoc.Load(pilotVsSgmlReader); statsXmlDoc.Save(Console.Out); statsXmlDoc.Save(@"C:\response.xml"); */ }
public void PerTestSetup() { _mockHtmlToXmlLoader = new Mock <IHtmlToXMLLoader>(); _mockHtmlToXmlLoader .Setup(l => l.LoadHtmlPageAsXmlByPost(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <ProxySettingsDTO>())) .Returns(_xmlDocumentDoc); _classUnderTest = new HTCPilotScoreSvc(_mockHtmlToXmlLoader.Object); }
/// <summary> /// Thread start point for the stats loader thread. /// </summary> /// <param name="obj">DataLoaderThreadParams</param> public void LoaderThreadEntryPoint(object obj) { DataLoaderThreadParams param = (DataLoaderThreadParams)obj; try { bool onlyOneToLoad = param.toursToLoad.Count * param.pilotIdList.Count == 1; foreach (TourNode tour in param.toursToLoad) { foreach (string pilotId in param.pilotIdList) { // // Load the Stats objects. // string statsURL = ConfigurationManager.AppSettings["statsURL"]; HTCPilotStatsSvc statsSvc = new HTCPilotStatsSvc(); try { param.statsList.Add(statsSvc.GetPilotStats(pilotId, tour, param.proxySettings, statsURL)); } catch (Exception e) { LoaderError loaderError = new LoaderError(); loaderError.tourId = tour.TourId; loaderError.pilotName = pilotId; loaderError.errorMessage = string.Format(" - could not load stats objects for pilot {0} for {1} tour {2}.", pilotId, tour.TourType.ToString(), tour.TourId); param.statsErrorList.Add(loaderError); Utility.WriteDebugTraceFile(e); } // Wait between calls. Thread.Sleep(_waitTimeMillsecondsBetweenHttpCallsToHtc); progressBarLoading.Invoke(param.updateProgressCallBack); // // Load the scores objects. // HTCPilotScoreSvc scoreSvc = new HTCPilotScoreSvc(); string scoresURL = ConfigurationManager.AppSettings["scoresURL"]; try { param.scoreList.Add(scoreSvc.GetPilotScore(pilotId, tour, param.proxySettings, scoresURL)); } catch (Exception e) { LoaderError error = new LoaderError(); error.tourId = tour.TourId; error.pilotName = pilotId; error.errorMessage = string.Format(" - could not load scores objects for pilot {0} for {1} tour {2}.", pilotId, tour.TourType.ToString(), tour.TourId); param.scoreErrorList.Add(error); Utility.WriteDebugTraceFile(e); } progressBarLoading.Invoke(param.updateProgressCallBack); if (!onlyOneToLoad) Thread.Sleep(_waitTimeMillsecondsBetweenHttpCallsToHtc); } } } finally { btnLoad.Invoke(param.loadCompletedCallBack); } }