Example #1
0
        public void GetSavedSearches_ReturnsTwitterAccessorResult()
        {
            // Arrange
            var    controller     = CreateSavedSearchJsonController();
            string query          = TestHelper.GenerateString();
            var    expectedResult = TestHelper.GenerateString();

            _fakeSavedSearchQueryGenerator.CallsTo(x => x.GetSavedSearchesQuery()).Returns(query);
            _fakeTwitterAccessor.ArrangeExecuteJsonGETQuery(query, expectedResult);

            // Act
            var result = controller.GetSavedSearches();

            // Assert
            Assert.AreEqual(result, expectedResult);
        }
        public void GetFavoriteTweetsWithUser_AnyData_ReturnsTwitterAccessorResult()
        {
            // Arrange
            var queryExecutor  = CreateUserJsonController();
            var expectedQuery  = TestHelper.GenerateString();
            var expectedResult = TestHelper.GenerateString();
            var parameters     = It.IsAny <IGetUserFavoritesQueryParameters>();

            _fakeUserQueryGenerator.CallsTo(x => x.GetFavoriteTweetsQuery(parameters)).Returns(expectedQuery);
            _fakeTwitterAccessor.ArrangeExecuteJsonGETQuery(expectedQuery, expectedResult);

            // Act
            var result = queryExecutor.GetFavoriteTweets(parameters);

            // Assert
            Assert.AreEqual(result, expectedResult);
        }
Example #3
0
        public void GetAuthenticatedUserSettingsJson_ReturnsAccessorJsonResult()
        {
            string query      = Guid.NewGuid().ToString();
            string jsonResult = Guid.NewGuid().ToString();

            // Arrange
            var controller = CreateAccountJsonController();

            ArrangeGetAuthenticatedUserAccountSettingsQuery(query);
            _fakeTwitterAccessor.ArrangeExecuteJsonGETQuery(query, jsonResult);

            // Act
            var result = controller.GetAuthenticatedUserSettingsJson();

            // Assert
            Assert.AreEqual(result, jsonResult);
        }
Example #4
0
        public void GetLatestMessages_ReturnsTwitterAccessorResult()
        {
            // Arrange
            var jsonController = CreateMessageJsonController();
            var count          = new Random().Next();
            var query          = TestHelper.GenerateString();
            var expectedResult = TestHelper.GenerateString();

            ArrangeQueryGeneratorGetLatestMessages(count, query);
            _fakeTwitterAccessor.ArrangeExecuteJsonGETQuery(query, expectedResult);

            // Act
            var result = jsonController.GetLatestMessages(count);

            // Assert
            Assert.AreEqual(result, expectedResult);
        }
Example #5
0
        public void GetPlaceFromId_ReturnsGeoQueryExecutorResult()
        {
            string expectedResult = Guid.NewGuid().ToString();

            // Arrange
            var controller = CreateGeoJsonController();

            string placeId = Guid.NewGuid().ToString();
            string query   = Guid.NewGuid().ToString();

            ArrangeGetPlaceFromIdQueryGenerator(placeId, query);
            _fakeTwitterAccessor.ArrangeExecuteJsonGETQuery(query, expectedResult);

            // Act
            var result = controller.GetPlaceFromId(placeId);

            // Assert
            Assert.AreEqual(result, expectedResult);
        }
Example #6
0
        public void GetRetweets_FromTweet_ReturnsResponse()
        {
            // Arrange
            var queryExecutor = CreateTweetJsonController();

            var tweetDTO = A.Fake <ITweetDTO>();
            var tweet    = A.Fake <ITweet>();

            tweet.CallsTo(x => x.TweetDTO).Returns(tweetDTO);

            var query          = TestHelper.GenerateString();
            var expectedResult = TestHelper.GenerateString();

            _fakeTweetQueryGenerator.CallsTo(x => x.GetRetweetsQuery(tweetDTO)).Returns(query);
            _fakeTwitterAccessor.ArrangeExecuteJsonGETQuery(query, expectedResult);

            // Act
            var result = queryExecutor.GetRetweets(tweet);

            // Assert
            Assert.AreEqual(result, expectedResult);
        }