private void GetTweets(object sender, EventArgs e)
 {
     tweets = tweetController.Get(cookie);
     Log.Info("tweet", tweets[0].Id);
     adapter = new TweetAdapter(tweets);
     rvTweets.SetAdapter(adapter);
 }
Exemplo n.º 2
0
        public void GetAllTweetsSqlDB()
        {
            //Arrange
            var expectedResultSQL = new string[] { "Tweet1", "Tweet2", "Tweet3" };
            var mySqlDatabase     = new SqlDatabase();
            var tweetController   = new TweetController(mySqlDatabase);

            //Act
            var result = tweetController.Get();

            // Assert
            Assert.Equal(expectedResultSQL, result);
        }
Exemplo n.º 3
0
        public void Get_CorrectLink_TweetString()
        {
            //Arrange
            string          tweetLink       = "https://twitter.com/tweeter/status/489879052157595649";
            string          expected        = "Stay safe. Love one another. Life is hard for everyone, so spread peace and happiness. #tweetlove";
            TweetController tweetController = new TweetController();

            //Act
            var result = tweetController.Get(tweetLink);

            //Assert
            Assert.AreEqual(expected, result.Result);
        }
Exemplo n.º 4
0
        public void GetAllTweetsMongoDB()
        {
            //Arrange

            var expectedResultMongo = new string[] { "sheep", "pencilcase" };
            var myMongoDB           = new Repository();
            var tweetController     = new TweetController(myMongoDB);

            //Act
            var result = tweetController.Get();

            // Assert
            Assert.Equal(expectedResultMongo, result);
        }
Exemplo n.º 5
0
        public async void Get_Not_Exists()
        {
            TweetControllerMockFacade mock = new TweetControllerMockFacade();

            mock.ServiceMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ApiTweetResponseModel>(null));
            TweetController controller = new TweetController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = new DefaultHttpContext();

            IActionResult response = await controller.Get(default(int));

            response.Should().BeOfType <StatusCodeResult>();
            (response as StatusCodeResult).StatusCode.Should().Be((int)HttpStatusCode.NotFound);
            mock.ServiceMock.Verify(x => x.Get(It.IsAny <int>()));
        }