Example #1
0
        public HeartListResponse GetECGS(string code)
        {
            var token            = _withingService.GetToken(code);
            var heartGetResponse = _withingService.ListECGs(token.access_token);

            heartGetResponse.body.series.ToList().ForEach(e => e.ecg.HeartGetResponse = _withingService.GetECG(token.access_token, e.ecg.signalid));

            return(heartGetResponse);
        }
Example #2
0
        public void GetECG()
        {
            WithingsService withingsService = new WithingsService(_configuration);

            using IWebDriver driver = CreateDriver(false);
            var authUrl = DEMOMODE ? $"{withingsService.AuthUrl}&mode=demo" : withingsService.AuthUrl;

            driver.Navigate().GoToUrl(authUrl);
            Login(driver);
            GiveConsent(driver);

            Assert.IsTrue(driver.Url.Contains("code="));
            var code = driver.Url.Split("code=")[1].Split("&")[0];

            Assert.IsNotNull(code);

            driver.Close();

            var token = withingsService.GetToken(code);

            Assert.IsNotNull(token);
            Assert.IsFalse(string.IsNullOrEmpty(token.access_token));

            //no ecg's in demo mode.
            if (DEMOMODE)
            {
                return;
            }

            var ecgs = withingsService.ListECGs(token.access_token);

            Assert.IsTrue(ecgs.body.series.Length > 0);
            var ecg = withingsService.GetECG(token.access_token, ecgs.body.series.First().ecg.signalid);

            Assert.IsTrue(ecg.body.signal.Length > 0);
        }