Ejemplo n.º 1
0
        public async Task LoadDataAsyncTestAsync()
        {
            string apiUrl   = "https://catfact.ninja/fact?max_length=140";
            string response = await APIConnection.LoadDataAsync(apiUrl);

            if (!response.Any())
            {
                Assert.Fail();
            }
        }
        public async Task ParseJSONForPlotTestAsync()
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
            string apiUrl   = "http://api.coinranking.com/v1/public/coins?base=PLN&timePeriod=7d";
            string response = await APIConnection.LoadDataAsync(apiUrl);

            List <DataPoint> values = JSONParser.ParseJSONForPlot(response);

            if (!values.Any())
            {
                Assert.Fail();
            }
        }
        public async Task ParseJSONTestAsync()
        {
            JSONParser parser   = new JSONParser();
            string     apiUrl   = "https://catfact.ninja/fact?max_length=140";
            string     response = await APIConnection.LoadDataAsync(apiUrl);

            try
            {
                Person result = JSONParser.ParseJSON(response, apiUrl);
            }

            catch (Exception ex)
            {
                Assert.Fail();
            }
        }