public void SearchTweet_BasedOnQuery_ReturnsTwitterAccessorStatuses() { // Arrange var queryExecutor = CreateSearchQueryExecutor(); _fakeSearchQueryGenerator.CallsTo(x => x.GetSearchTweetsQuery(_tweetSearchParameter)).Returns(_httpQuery); _fakeTwitterAccessor.ArrangeExecuteGETQuery(_httpQuery, _searchResultDTO); // Act var result = queryExecutor.SearchTweets(_searchQuery); // Assert Assert.IsTrue(result.ContainsAll(_tweetDTOs)); }
private T GetQueryResult <T>(string query) where T : class { var result = A.Fake <T>(); _fakeTwitterAccessor.ArrangeExecuteGETQuery(query, result); return(result); }
public void GetRetweets_FromTweetDTO_ReturnsTwitterAccessorResult() { // Arrange var queryExecutor = CreateTweetQueryExecutor(); var tweetDTO = A.Fake <ITweetDTO>(); var query = TestHelper.GenerateString(); IEnumerable <ITweetDTO> expectedResult = new List <ITweetDTO>(); _fakeTweetQueryGenerator.CallsTo(x => x.GetRetweetsQuery(tweetDTO)).Returns(query); _fakeTwitterAccessor.ArrangeExecuteGETQuery(query, expectedResult); // Act var result = queryExecutor.GetRetweets(tweetDTO); // Assert Assert.AreEqual(result, expectedResult); }
public void GetTokenRateLimits_ReturnsJsonTwitterAccessor() { var expectedResult = A.Fake <ICredentialsRateLimits>(); // Arrange var queryExecutor = CreateHelpQueryExecutor(); string query = Guid.NewGuid().ToString(); ArrangeQueryGeneratorGetTokenRateLimits(query); _fakeTwitterAccessor.ArrangeExecuteGETQuery(query, expectedResult); // Act var result = queryExecutor.GetCurrentCredentialsRateLimits(); // Assert Assert.AreEqual(result, expectedResult); }
public void GetFavouriteTweetsWithUserDTO_AnyData_ReturnsTwitterAccessorResult() { // Arrange var queryExecutor = CreateUserQueryExecutor(); var userDTO = A.Fake <IUserDTO>(); var maximumNumberOfTweets = TestHelper.GenerateRandomInt(); var expectedQuery = TestHelper.GenerateString(); IEnumerable <ITweetDTO> expectedResult = new[] { A.Fake <ITweetDTO>() }; _fakeUserQueryGenerator.CallsTo(x => x.GetFavouriteTweetsQuery(userDTO, maximumNumberOfTweets)).Returns(expectedQuery); _fakeTwitterAccessor.ArrangeExecuteGETQuery(expectedQuery, expectedResult); // Act var result = queryExecutor.GetFavouriteTweets(userDTO, maximumNumberOfTweets); // Assert Assert.AreEqual(result, expectedResult); }
public void GetRetweets_FromTweetIdentifier_ReturnsTwitterAccessorResult() { // Arrange var queryExecutor = CreateTweetQueryExecutor(); var tweetIdentifier = A.Fake <ITweetIdentifier>(); var query = TestHelper.GenerateString(); var maxRetweetsToRetrieve = TestHelper.GenerateRandomInt(); IEnumerable <ITweetDTO> expectedResult = GenerateExpectedIRetweetsCursorResults(); _fakeTweetQueryGenerator.CallsTo(x => x.GetRetweetsQuery(tweetIdentifier, maxRetweetsToRetrieve)).Returns(query); _fakeTwitterAccessor.ArrangeExecuteGETQuery(query, expectedResult); // Act var result = queryExecutor.GetRetweets(tweetIdentifier, maxRetweetsToRetrieve); // Assert Assert.AreEqual(result, expectedResult); }
public void GetPlaceTrendsAt_WithLocationId_ReturnsFirstObjectFromTheResults() { // Arrange var queryExecutor = CreateTrendsQueryExecutor(); var query = TestHelper.GenerateString(); var locationId = TestHelper.GenerateRandomLong(); var expectedResult = A.Fake <IPlaceTrends>(); var expectedTwitterAccessorResults = new[] { expectedResult }; _fakeTrendsQueryGenerator.CallsTo(x => x.GetPlaceTrendsAtQuery(locationId)).Returns(query); _fakeTwitterAccessor.ArrangeExecuteGETQuery(query, expectedTwitterAccessorResults); // Act var result = queryExecutor.GetPlaceTrendsAt(locationId); // Assert Assert.AreEqual(result, expectedResult); }
public void SearchTweet_BasedOnQuery_ReturnsTwitterAccessorStatuses() { // Arrange var queryExecutor = CreateSearchQueryExecutor(); var tweetDTOs = new List <ITweetDTO> { A.Fake <ITweetDTO>() }; _fakeSearchQueryGenerator.CallsTo(x => x.GetSearchTweetsQuery(_searchQuery)).Returns(_httpQuery); _fakeTwitterAccessor.ArrangeExecuteGETQuery(_httpQuery, _jObject); _fakeSearchQueryHelper.CallsTo(x => x.GetTweetsFromJsonObject(_jObject)).Returns(tweetDTOs); // Act var result = queryExecutor.SearchTweets(_searchQuery); // Assert Assert.AreEqual(result, tweetDTOs); }
public void GetLatestMessagesReceived_ReturnsTwitterAccessorResult() { IEnumerable <IMessageDTO> expectedResult = new List <IMessageDTO> { A.Fake <IMessageDTO>() }; // Arrange var queryExecutor = CreateMessageQueryExecutor(); var maximumMessages = new Random().Next(); var query = Guid.NewGuid().ToString(); ArrangeQueryGeneratorGetLatestMessagesReceived(maximumMessages, query); _fakeTwitterAccessor.ArrangeExecuteGETQuery(query, expectedResult); // Act var result = queryExecutor.GetLatestMessagesReceived(maximumMessages); // Assert Assert.AreEqual(result, expectedResult); }
public void GetSavedSearches_ReturnsTwitterAccessorResult() { // Arrange var controller = CreateSavedSearchQueryExecutor(); string query = TestHelper.GenerateString(); IEnumerable <ISavedSearchDTO> expectedResult = new List <ISavedSearchDTO>(); _fakeSavedSearchQueryGenerator.CallsTo(x => x.GetSavedSearchesQuery()).Returns(query); _fakeTwitterAccessor.ArrangeExecuteGETQuery(query, expectedResult); // Act var result = controller.GetSavedSearches(); // Assert Assert.AreEqual(result, expectedResult); }
public void GetLoggedUserSettings_ReturnsAccessorJsonResult() { string query = Guid.NewGuid().ToString(); var queryResult = A.Fake <IAccountSettingsDTO>(); // Arrange var controller = CreateAccountQueryExecutor(); ArrangeGetLoggedUserAccountSettingsQuery(query); _fakeTwitterAccessor.ArrangeExecuteGETQuery(query, queryResult); // Act var result = controller.GetLoggedUserAccountSettings(); // Assert Assert.AreEqual(result, queryResult); }
public void GetPlaceFromId_ReturnsGeoQueryExecutorResult() { var expectedResult = A.Fake <IPlace>(); // Arrange var controller = CreateGeoQueryExecutor(); string placeId = Guid.NewGuid().ToString(); string query = Guid.NewGuid().ToString(); ArrangeGetPlaceFromIdQueryGenerator(placeId, query); _fakeTwitterAccessor.ArrangeExecuteGETQuery(query, expectedResult); // Act var result = controller.GetPlaceFromId(placeId); // Assert Assert.AreEqual(result, expectedResult); }
public void GetFavouriteTweetsWithUserDTO_AnyData_ReturnsTwitterAccessorResult() { // Arrange var queryExecutor = CreateUserQueryExecutor(); TestHelper.GenerateRandomInt(); var expectedQuery = TestHelper.GenerateString(); IEnumerable <ITweetDTO> expectedResult = new[] { A.Fake <ITweetDTO>() }; var parameters = It.IsAny <IGetUserFavoritesQueryParameters>(); _fakeUserQueryGenerator.CallsTo(x => x.GetFavoriteTweetsQuery(parameters)).Returns(expectedQuery); _fakeTwitterAccessor.ArrangeExecuteGETQuery(expectedQuery, expectedResult); // Act var result = queryExecutor.GetFavoriteTweets(parameters); // Assert Assert.AreEqual(result, expectedResult); }