示例#1
0
        public async Task <IActionResult> GetTrainData([FromBody] TwitterProfileApi apiprofile)
        {
            if (apiprofile == null)
            {
                return(BadRequest());
            }

            if (apiprofile.Name == null)
            {
                return(BadRequest());
            }

            var profile = _repository.Get(apiprofile);

            if (profile == null)
            {
                return(NotFound());
            }
            try
            {
                var tweets = await _twitterService.GetAllTweetsFromProfile(profile);

                if (tweets == null)
                {
                    return(BadRequest());
                }
                return(Ok(tweets));
            }
            catch (Exception e)
            {
                return(BadRequest(e));
            }
        }
示例#2
0
 public void TestGetList()
 {
     Assert.DoesNotThrow(() => Task.Run(() => _service.GetAllTweetsFromProfile(new TwitterProfile("UBoat2018"))));
 }