public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder <FriendshipQueryExecutor>();
     _fakeFriendshipQueryGenerator = _fakeBuilder.GetFake <IFriendshipQueryGenerator>();
     _fakeUserQueryValidator       = _fakeBuilder.GetFake <IUserQueryValidator>();
     _fakeTwitterAccessor          = _fakeBuilder.GetFake <ITwitterAccessor>();
 }
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<FriendshipQueryExecutor>();
     _fakeFriendshipQueryGenerator = _fakeBuilder.GetFake<IFriendshipQueryGenerator>();
     _fakeUserQueryValidator = _fakeBuilder.GetFake<IUserQueryValidator>();
     _fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();
 }
Пример #3
0
 public AuthQueryExecutorTests()
 {
     _fakeBuilder            = new FakeClassBuilder <AuthQueryExecutor>();
     _fakeAuthQueryGenerator = _fakeBuilder.GetFake <IAuthQueryGenerator>().FakedObject;
     _fakeOAuthWebRequestGeneratorFactory = _fakeBuilder.GetFake <IOAuthWebRequestGeneratorFactory>().FakedObject;
     _fakeTwitterAccessor = _fakeBuilder.GetFake <ITwitterAccessor>().FakedObject;
 }
Пример #4
0
 public void TestInitialize()
 {
     _fakeBuilder           = new FakeClassBuilder <UserController>();
     _fakeUserQueryExecutor = _fakeBuilder.GetFake <IUserQueryExecutor>();
     _fakeTweetFactory      = _fakeBuilder.GetFake <ITweetFactory>();
     _fakeUserFactory       = _fakeBuilder.GetFake <IUserFactory>();
 }
 public void TestInitialize()
 {
     _fakeBuilder                = new FakeClassBuilder <TweetQueryGenerator>();
     _fakeGeoQueryGenerator      = _fakeBuilder.GetFake <IGeoQueryGenerator>();
     _fakeTweetQueryValidator    = _fakeBuilder.GetFake <ITweetQueryValidator>();
     _fakeTwitterStringFormatter = _fakeBuilder.GetFake <ITwitterStringFormatter>();
 }
Пример #6
0
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<UserController>();
     _fakeUserQueryExecutor = _fakeBuilder.GetFake<IUserQueryExecutor>();
     _fakeTweetFactory = _fakeBuilder.GetFake<ITweetFactory>();
     _fakeUserFactory = _fakeBuilder.GetFake<IUserFactory>();
 }
Пример #7
0
 public UserQueryExecutorTests()
 {
     _fakeBuilder            = new FakeClassBuilder <UserQueryExecutor>();
     _fakeUserQueryGenerator = _fakeBuilder.GetFake <IUserQueryGenerator>().FakedObject;
     _fakeTwitterAccessor    = _fakeBuilder.GetFake <ITwitterAccessor>().FakedObject;
     _fakeWebHelper          = _fakeBuilder.GetFake <IWebHelper>().FakedObject;
 }
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<TweetQueryGenerator>();
     _fakeGeoQueryGenerator = _fakeBuilder.GetFake<IGeoQueryGenerator>();
     _fakeTweetQueryValidator = _fakeBuilder.GetFake<ITweetQueryValidator>();
     _fakeTwitterStringFormatter = _fakeBuilder.GetFake<ITwitterStringFormatter>();
 }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<RateLimitCacheManager>();
            _fakeRateLimitCache = _fakeBuilder.GetFake<IRateLimitCache>();
            _fakeRateLimitHelper = _fakeBuilder.GetFake<IRateLimitHelper>();
            _fakeTwitterRequester = _fakeBuilder.GetFake<ITwitterRequester>();
            _fakeHelpQueryGenerator = _fakeBuilder.GetFake<IHelpQueryGenerator>();
            _fakeJsonObjectConverter = _fakeBuilder.GetFake<IJsonObjectConverter>();
            _fakeCredentialsAccessor = _fakeBuilder.GetFake<ICredentialsAccessor>();
            _fakeTwitterQueryFactory = _fakeBuilder.GetFake<ITwitterQueryFactory>();

            InitializeData();

            _fakeRateLimitHelper.CallsTo(x => x.GetEndpointRateLimitFromQuery(TEST_QUERY, _credentialsRateLimits)).Returns(_endpointRateLimit);
            _fakeRateLimitCache.CallsTo(x => x.GetCredentialsRateLimits(_credentials)).Returns(_credentialsRateLimits);

            _fakeRateLimitCache.CallsTo(x => x.RefreshEntry(_credentials, _credentialsRateLimits)).Invokes(() =>
            {
                _fakeRateLimitCache.CallsTo(x => x.GetCredentialsRateLimits(_credentials)).Returns(_refreshedCredentialsRateLimits);
                _fakeRateLimitHelper.CallsTo(x => x.GetEndpointRateLimitFromQuery(TEST_QUERY, _refreshedCredentialsRateLimits)).Returns(_refreshedEndpointRateLimit);
            });

            _fakeCredentialsAccessor.SetupPassThrough<ICredentialsRateLimits>();

            _fakeHelpQueryGenerator.CallsTo(x => x.GetCredentialsLimitsQuery()).Returns(TEST_QUERY);

            _fakeTwitterRequester.CallsTo(x => x.ExecuteQuery(_twitterQuery, null)).Returns(TEST_QUERY);
            _fakeJsonObjectConverter.CallsTo(x => x.DeserializeObject<ICredentialsRateLimits>(TEST_QUERY, It.IsAny<JsonConverter[]>())).ReturnsNextFromSequence(_credentialsRateLimits, _credentialsRateLimits2);

            _fakeTwitterQueryFactory.CallsTo(x => x.Create(TEST_QUERY, It.IsAny<HttpMethod>(), It.IsAny<ITwitterCredentials>())).Returns(_twitterQuery);
        }
        public void TestInitialize()
        {
            _fakeBuilder             = new FakeClassBuilder <RateLimitCacheManager>();
            _fakeRateLimitCache      = _fakeBuilder.GetFake <IRateLimitCache>();
            _fakeRateLimitHelper     = _fakeBuilder.GetFake <IRateLimitHelper>();
            _fakeTwitterRequester    = _fakeBuilder.GetFake <ITwitterRequester>();
            _fakeHelpQueryGenerator  = _fakeBuilder.GetFake <IHelpQueryGenerator>();
            _fakeJsonObjectConverter = _fakeBuilder.GetFake <IJsonObjectConverter>();
            _fakeCredentialsAccessor = _fakeBuilder.GetFake <ICredentialsAccessor>();
            _fakeTwitterQueryFactory = _fakeBuilder.GetFake <ITwitterQueryFactory>();

            InitializeData();

            _fakeRateLimitHelper.CallsTo(x => x.GetTokenRateLimitFromQuery(TEST_QUERY, _tokenRateLimits)).Returns(_tokenRateLimit);
            _fakeRateLimitCache.CallsTo(x => x.GetTokenRateLimits(_credentials)).Returns(_tokenRateLimits);

            _fakeRateLimitCache.CallsTo(x => x.RefreshEntry(_credentials, _tokenRateLimits)).Invokes(() =>
            {
                _fakeRateLimitCache.CallsTo(x => x.GetTokenRateLimits(_credentials)).Returns(_refreshedTokenRateLimits);
                _fakeRateLimitHelper.CallsTo(x => x.GetTokenRateLimitFromQuery(TEST_QUERY, _refreshedTokenRateLimits)).Returns(_refreshedTokenRateLimit);
            });

            _fakeCredentialsAccessor.SetupPassThrough <ITokenRateLimits>();

            _fakeHelpQueryGenerator.CallsTo(x => x.GetCredentialsLimitsQuery()).Returns(TEST_QUERY);

            _fakeTwitterRequester.CallsTo(x => x.ExecuteQuery(_twitterQuery, null)).Returns(TEST_QUERY);
            _fakeJsonObjectConverter.CallsTo(x => x.DeserializeObject <ITokenRateLimits>(TEST_QUERY, It.IsAny <JsonConverter[]>())).ReturnsNextFromSequence(_tokenRateLimits, _tokenRateLimits2);

            _fakeTwitterQueryFactory.CallsTo(x => x.Create(TEST_QUERY, It.IsAny <HttpMethod>(), It.IsAny <ITwitterCredentials>())).Returns(_twitterQuery);
        }
        public void Initialize()
        {
            _fakeBuilder = new FakeClassBuilder<RateLimitHelper>();
            _tokenRateLimits = A.Fake<ITokenRateLimits>();

            _webHelper = new WebHelper(A.Fake<ITweetinviSettingsAccessor>());
            _attributeHelper = new AttributeHelper();
        }
        public void Initialize()
        {
            _fakeBuilder           = new FakeClassBuilder <RateLimitHelper>();
            _credentialsRateLimits = A.Fake <ICredentialsRateLimits>();

            _webHelper       = new WebHelper(A.Fake <ITweetinviSettingsAccessor>());
            _attributeHelper = new AttributeHelper();
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<UserQueryExecutor>();
            _fakeUserQueryGenerator = _fakeBuilder.GetFake<IUserQueryGenerator>();
            _fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();
            _fakeWebHelper = _fakeBuilder.GetFake<IWebHelper>();

            _cursorQueryIds = new List<long>();
        }
Пример #14
0
        public void Itinialize()
        {
            _fakeBuilder = new FakeClassBuilder<RateLimitCache>();

            _credentials = A.Fake<IOAuthCredentials>();
            _credentials2 = A.Fake<IOAuthCredentials>();
            _tokenRateLimits = A.Fake<ITokenRateLimits>();
            _tokenRateLimits2 = A.Fake<ITokenRateLimits>();
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder <FriendshipJsonController>();
            _fakeFriendshipQueryGenerator = _fakeBuilder.GetFake <IFriendshipQueryGenerator>();
            _fakeFriendshipFactory        = _fakeBuilder.GetFake <IFriendshipFactory>();
            _fakeTwitterAccessor          = _fakeBuilder.GetFake <ITwitterAccessor>();

            ArrangeFriendshipFactoryAuthorizations();
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<FriendshipJsonController>();
            _fakeFriendshipQueryGenerator = _fakeBuilder.GetFake<IFriendshipQueryGenerator>();
            _fakeFriendshipFactory = _fakeBuilder.GetFake<IFriendshipFactory>();
            _fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();

            ArrangeFriendshipFactoryAuthorizations();
        }
Пример #17
0
        public void Itinialize()
        {
            _fakeBuilder = new FakeClassBuilder <RateLimitCache>();

            _credentials      = A.Fake <IOAuthCredentials>();
            _credentials2     = A.Fake <IOAuthCredentials>();
            _tokenRateLimits  = A.Fake <ITokenRateLimits>();
            _tokenRateLimits2 = A.Fake <ITokenRateLimits>();
        }
Пример #18
0
        public void Itinialize()
        {
            _fakeBuilder = new FakeClassBuilder<RateLimitCache>();

            _credentials = A.Fake<ITwitterCredentials>();
            _credentials2 = A.Fake<ITwitterCredentials>();
            _credentialsRateLimits = A.Fake<ICredentialsRateLimits>();
            _credentialsRateLimits2 = A.Fake<ICredentialsRateLimits>();
        }
        public void TestInitialize()
        {
            _fakeBuilder            = new FakeClassBuilder <UserQueryExecutor>();
            _fakeUserQueryGenerator = _fakeBuilder.GetFake <IUserQueryGenerator>();
            _fakeTwitterAccessor    = _fakeBuilder.GetFake <ITwitterAccessor>();
            _fakeWebHelper          = _fakeBuilder.GetFake <IWebHelper>();

            _cursorQueryIds = new List <long>();
        }
        public void Itinialize()
        {
            _fakeBuilder = new FakeClassBuilder <RateLimitCache>();

            _credentials            = A.Fake <ITwitterCredentials>();
            _credentials2           = A.Fake <ITwitterCredentials>();
            _credentialsRateLimits  = A.Fake <ICredentialsRateLimits>();
            _credentialsRateLimits2 = A.Fake <ICredentialsRateLimits>();
        }
Пример #21
0
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder <MessageQueryGenerator>();
            _fakeMessageQueryValidator       = _fakeBuilder.GetFake <IMessageQueryValidator>();
            _fakeUserQueryParameterGenerator = _fakeBuilder.GetFake <IUserQueryParameterGenerator>();
            _fakeTwitterStringFormatter      = _fakeBuilder.GetFake <ITwitterStringFormatter>();

            _fakeUserQueryParameterGenerator.ArrangeGenerateIdParameter();
            _fakeUserQueryParameterGenerator.ArrangeGenerateScreenNameParameter();
        }
Пример #22
0
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<RateLimitUpdater>();
            _fakeRateLimitCacheManager = _fakeBuilder.GetFake<IRateLimitCacheManager>();
            _fakeCredentialsAccessor = _fakeBuilder.GetFake<ICredentialsAccessor>();

            InitializeData();

            _fakeRateLimitCacheManager.CallsTo(x => x.GetQueryRateLimit(TEST_QUERY, _credentials)).Returns(_endpointRateLimit);
            _fakeCredentialsAccessor.CallsTo(x => x.CurrentThreadCredentials).Returns(_credentials);
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder <TimelineQueryExecutor>();
            _fakeTimelineQueryGenerator = _fakeBuilder.GetFake <ITimelineQueryGenerator>();
            _fakeTwitterAccessor        = _fakeBuilder.GetFake <ITwitterAccessor>();

            InitData();

            // Do not initialize the query result for the different timeline from the ctor as it could false the result
            // Do not do : _fakeTimelineQueryGenerator.CallsTo(x => x.GetUserTimelineQuery(_fakeUserTimelineRequestParameters)).Returns(_expectedQuery);
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<FriendshipQueryGenerator>();
            _fakeUserQueryParameterGenerator = _fakeBuilder.GetFake<IUserQueryParameterGenerator>();
            _fakeUserQueryValidator = _fakeBuilder.GetFake<IUserQueryValidator>();

            _fakeUserQueryParameterGenerator.ArrangeGenerateIdParameter();
            _fakeUserQueryParameterGenerator.ArrangeGenerateScreenNameParameter();
            _fakeUserQueryParameterGenerator.ArrangeGenerateIdOrScreenNameParameter();
            _fakeUserQueryValidator.ArrangeIsUserIdValid();
        }
Пример #25
0
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder <RateLimitUpdater>();
            _fakeRateLimitCacheManager = _fakeBuilder.GetFake <IRateLimitCacheManager>();
            _fakeCredentialsAccessor   = _fakeBuilder.GetFake <ICredentialsAccessor>();

            InitializeData();

            _fakeRateLimitCacheManager.CallsTo(x => x.GetQueryRateLimit(TEST_QUERY, _credentials)).Returns(_endpointRateLimit);
            _fakeCredentialsAccessor.CallsTo(x => x.CurrentThreadCredentials).Returns(_credentials);
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder <FriendshipQueryGenerator>();
            _fakeUserQueryParameterGenerator = _fakeBuilder.GetFake <IUserQueryParameterGenerator>();
            _fakeUserQueryValidator          = _fakeBuilder.GetFake <IUserQueryValidator>();

            _fakeUserQueryParameterGenerator.ArrangeGenerateIdParameter();
            _fakeUserQueryParameterGenerator.ArrangeGenerateScreenNameParameter();
            _fakeUserQueryParameterGenerator.ArrangeGenerateIdOrScreenNameParameter();
            _fakeUserQueryValidator.ArrangeIsUserIdValid();
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<MessageQueryGenerator>();
            _fakeMessageQueryValidator = _fakeBuilder.GetFake<IMessageQueryValidator>();
            _fakeUserQueryParameterGenerator = _fakeBuilder.GetFake<IUserQueryParameterGenerator>();
            _fakeUserQueryValidator = _fakeBuilder.GetFake<IUserQueryValidator>();
            _fakeTwitterStringFormatter = _fakeBuilder.GetFake<ITwitterStringFormatter>();

            _fakeUserQueryParameterGenerator.ArrangeGenerateIdParameter();
            _fakeUserQueryParameterGenerator.ArrangeGenerateScreenNameParameter();
        }
Пример #28
0
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<LoggedUser>();
            _fakeCredentialsAccessor = _fakeBuilder.GetFake<ICredentialsAccessor>();
            _fakeTimelineController = _fakeBuilder.GetFake<ITimelineController>();
            _fakeFriendshipController = _fakeBuilder.GetFake<IFriendshipController>();
            _fakeSavedSearchController = _fakeBuilder.GetFake<ISavedSearchController>();
            _fakeMessageController = _fakeBuilder.GetFake<IMessageController>();
            _fakeTweetController = _fakeBuilder.GetFake<ITweetController>();
            _fakeAccountController = _fakeBuilder.GetFake<IAccountController>();

            InitData();
        }
Пример #29
0
        public void TestInitialize()
        {
            _fakeBuilder               = new FakeClassBuilder <LoggedUser>();
            _fakeCredentialsAccessor   = _fakeBuilder.GetFake <ICredentialsAccessor>();
            _fakeTimelineController    = _fakeBuilder.GetFake <ITimelineController>();
            _fakeFriendshipController  = _fakeBuilder.GetFake <IFriendshipController>();
            _fakeSavedSearchController = _fakeBuilder.GetFake <ISavedSearchController>();
            _fakeMessageController     = _fakeBuilder.GetFake <IMessageController>();
            _fakeTweetController       = _fakeBuilder.GetFake <ITweetController>();
            _fakeAccountController     = _fakeBuilder.GetFake <IAccountController>();

            InitData();
        }
Пример #30
0
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder <RateLimitAwaiter>();
            _fakeRateLimitCacheManager = _fakeBuilder.GetFake <IRateLimitCacheManager>();
            _fakeCredentialsAccessor   = _fakeBuilder.GetFake <ICredentialsAccessor>();
            _fakeThreadHelper          = _fakeBuilder.GetFake <IThreadHelper>();

            _credentials    = A.Fake <ITwitterCredentials>();
            _tokenRateLimit = A.Fake <ITokenRateLimit>();
            _tokenRateLimit.CallsTo(x => x.Remaining).Returns(0);
            _tokenRateLimit.CallsTo(x => x.ResetDateTimeInMilliseconds).Returns(TIME_TO_WAIT);

            _fakeRateLimitCacheManager.CallsTo(x => x.GetQueryRateLimit(TEST_QUERY, _credentials)).Returns(_tokenRateLimit);
            _fakeCredentialsAccessor.CallsTo(x => x.CurrentThreadCredentials).Returns(_credentials);
        }
Пример #31
0
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<RateLimitAwaiter>();
            _fakeRateLimitCacheManager = _fakeBuilder.GetFake<IRateLimitCacheManager>();
            _fakeCredentialsAccessor = _fakeBuilder.GetFake<ICredentialsAccessor>();
            _fakeThreadHelper = _fakeBuilder.GetFake<IThreadHelper>();

            _credentials = A.Fake<ITwitterCredentials>();
            _endpointRateLimit = A.Fake<IEndpointRateLimit>();
            _endpointRateLimit.CallsTo(x => x.Remaining).Returns(0);
            _endpointRateLimit.CallsTo(x => x.ResetDateTimeInMilliseconds).Returns(TIME_TO_WAIT);

            _fakeRateLimitCacheManager.CallsTo(x => x.GetQueryRateLimit(TEST_QUERY, _credentials)).Returns(_endpointRateLimit);
            _fakeCredentialsAccessor.CallsTo(x => x.CurrentThreadCredentials).Returns(_credentials);
        }
Пример #32
0
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<TweetQueryExecutor>();
            _fakeTweetQueryGenerator = _fakeBuilder.GetFake<ITweetQueryGenerator>();
            _fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();

            var fakeWebExceptionInfoExtractor = A.Fake<IWebExceptionInfoExtractor>();

            var twitter139ExceptionInfos = new TwitterExceptionInfo { Code = 139 };
            fakeWebExceptionInfoExtractor.CallsTo(x => x.GetTwitterExceptionInfo(It.IsAny<WebException>())).Returns(new [] { twitter139ExceptionInfos });
            _fake139TwitterException = new TwitterException(fakeWebExceptionInfoExtractor, new WebException(), TestHelper.GenerateString());

            var twitterOtherExceptionInfos = new TwitterExceptionInfo { Code = 1 };
            fakeWebExceptionInfoExtractor.CallsTo(x => x.GetTwitterExceptionInfo(It.IsAny<WebException>())).Returns(new[] { twitterOtherExceptionInfos });
            _fakeOtherTwitterException = new TwitterException(fakeWebExceptionInfoExtractor, new WebException(), TestHelper.GenerateString());
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<FriendshipController>();
            _fakeFriendshipQueryExecutor = _fakeBuilder.GetFake<IFriendshipQueryExecutor>();
            _fakeUserFactory = _fakeBuilder.GetFake<IUserFactory>();
            _fakeFriendshipFactory = _fakeBuilder.GetFake<IFriendshipFactory>();

            _fakeFriendshipFactory
                .CallsTo(x => x.GenerateFriendshipAuthorizations(A<bool>.Ignored, A<bool>.Ignored))
                .ReturnsLazily((bool retweets, bool notification) =>
                {
                    var fakeAuthorization = A.Fake<IFriendshipAuthorizations>();
                    fakeAuthorization.RetweetsEnabled = retweets;
                    fakeAuthorization.DeviceNotificationEnabled = notification;
                    return fakeAuthorization;
                });
        }
        public void TestInitialize()
        {
            _fakeBuilder               = new FakeClassBuilder <TimelineController>();
            _fakeTweetFactory          = _fakeBuilder.GetFake <ITweetFactory>();
            _fakeUserFactory           = _fakeBuilder.GetFake <IUserFactory>();
            _fakeTimelineQueryExecutor = _fakeBuilder.GetFake <ITimelineQueryExecutor>();
            _fakeUserTimelineRequestParameterFactory     = _fakeBuilder.GetFake <IFactory <IUserTimelineRequestParameters> >();
            _fakeMentionsTimelineRequestParameterFactory = _fakeBuilder.GetFake <IFactory <IMentionsTimelineRequestParameters> >();

            InitData();

            _fakeUserFactory.CallsTo(x => x.GetUserIdentifierFromUser(_fakeUser)).Returns(_fakeUserIdentifier);
            _fakeUserFactory.CallsTo(x => x.GenerateUserIdentifierFromScreenName(_userName)).Returns(_fakeUserIdentifier);
            _fakeUserFactory.CallsTo(x => x.GenerateUserIdentifierFromId(_userId)).Returns(_fakeUserIdentifier);
            _fakeUserTimelineRequestParameterFactory.CallsTo(x => x.Create()).Returns(_fakeUserTimelineRequestParameters);
            _fakeMentionsTimelineRequestParameterFactory.CallsTo(x => x.Create()).Returns(_fakeMentionsTimelineRequestParameters);
        }
Пример #35
0
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder <SearchQueryExecutor>();
            _fakeSearchQueryGenerator = _fakeBuilder.GetFake <ISearchQueryGenerator>();
            _fakeSearchQueryHelper    = _fakeBuilder.GetFake <ISearchQueryHelper>();
            _fakeTwitterAccessor      = _fakeBuilder.GetFake <ITwitterAccessor>();
            _fakeTweetHelper          = _fakeBuilder.GetFake <ITweetHelper>();

            _searchQuery      = TestHelper.GenerateString();
            _httpQuery        = TestHelper.GenerateString();
            _statusesJson     = TestHelper.GenerateString();
            _originalTweetDTO = GenerateTweetDTO(true);
            _retweetDTO       = GenerateTweetDTO(false);

            _jObject             = new JObject();
            _jObject["statuses"] = _statusesJson;
        }
Пример #36
0
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder <FriendshipController>();
            _fakeFriendshipQueryExecutor = _fakeBuilder.GetFake <IFriendshipQueryExecutor>();
            _fakeUserFactory             = _fakeBuilder.GetFake <IUserFactory>();
            _fakeFriendshipFactory       = _fakeBuilder.GetFake <IFriendshipFactory>();

            _fakeFriendshipFactory
            .CallsTo(x => x.GenerateFriendshipAuthorizations(A <bool> .Ignored, A <bool> .Ignored))
            .ReturnsLazily((bool retweets, bool notification) =>
            {
                var fakeAuthorization                       = A.Fake <IFriendshipAuthorizations>();
                fakeAuthorization.RetweetsEnabled           = retweets;
                fakeAuthorization.DeviceNotificationEnabled = notification;
                return(fakeAuthorization);
            });
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<TimelineController>();
            _fakeTweetFactory = _fakeBuilder.GetFake<ITweetFactory>();
            _fakeUserFactory = _fakeBuilder.GetFake<IUserFactory>();
            _fakeTimelineQueryExecutor = _fakeBuilder.GetFake<ITimelineQueryExecutor>();
            _fakeTimelineQueryParameterGenerator = _fakeBuilder.GetFake<ITimelineQueryParameterGenerator>();

            InitData();

            _fakeUserFactory.CallsTo(x => x.GenerateUserIdentifierFromScreenName(_userName)).Returns(_fakeUserIdentifier);
            _fakeUserFactory.CallsTo(x => x.GenerateUserIdentifierFromId(_userId)).Returns(_fakeUserIdentifier);

            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.CreateUserTimelineQueryParameters(_fakeUser, _fakeUserTimelineParameters)).Returns(_fakeUserTimelineQueryParameters);
            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.CreateUserTimelineQueryParameters(_fakeUserIdentifier, _fakeUserTimelineParameters)).Returns(_fakeUserTimelineQueryParameters);
            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.CreateUserTimelineParameters()).Returns(_fakeUserTimelineParameters);
            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.CreateMentionsTimelineParameters()).Returns(_fakeMentionsTimelineParameters);
        }
Пример #38
0
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder <TimelineJsonController>();
            _fakeTimelineQueryGenerator = _fakeBuilder.GetFake <ITimelineQueryGenerator>();
            _fakeTwitterAccessor        = _fakeBuilder.GetFake <ITwitterAccessor>();
            _fakeUserFactory            = _fakeBuilder.GetFake <IUserFactory>();
            _fakeHomeTimelineRequestParameterFactory     = _fakeBuilder.GetFake <IFactory <IHomeTimelineRequestParameters> >();
            _fakeUserTimelineRequestParameterFactory     = _fakeBuilder.GetFake <IFactory <IUserTimelineRequestParameters> >();
            _fakeMentionsTimelineRequestParameterFactory = _fakeBuilder.GetFake <IFactory <IMentionsTimelineRequestParameters> >();

            InitData();

            _fakeTwitterAccessor.CallsTo(x => x.ExecuteJsonGETQuery(_expectedQuery)).Returns(_expectedResult);

            _fakeUserFactory.CallsTo(x => x.GetUserIdentifierFromUser(_fakeUser)).Returns(_fakeUserIdentifier);
            _fakeUserFactory.CallsTo(x => x.GenerateUserIdentifierFromScreenName(_userName)).Returns(_fakeUserIdentifier);
            _fakeUserFactory.CallsTo(x => x.GenerateUserIdentifierFromId(_userId)).Returns(_fakeUserIdentifier);

            _fakeHomeTimelineRequestParameterFactory.CallsTo(x => x.Create()).Returns(_fakeHomeTimelineRequestParameters);
            _fakeUserTimelineRequestParameterFactory.CallsTo(x => x.Create()).Returns(_fakeUserTimelineRequestParameters);
            _fakeMentionsTimelineRequestParameterFactory.CallsTo(x => x.Create()).Returns(_fakeMentionsTimelineRequestParameters);
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<TimelineJsonController>();
            _fakeTimelineQueryGenerator = _fakeBuilder.GetFake<ITimelineQueryGenerator>();
            _fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();
            _fakeUserFactory = _fakeBuilder.GetFake<IUserFactory>();
            _fakeTimelineQueryParameterGenerator = _fakeBuilder.GetFake<ITimelineQueryParameterGenerator>();
        
            InitData();

            _fakeTwitterAccessor.CallsTo(x => x.ExecuteJsonGETQuery(_expectedQuery)).Returns(_expectedResult);
            
            _fakeUserFactory.CallsTo(x => x.GenerateUserIdentifierFromScreenName(_userName)).Returns(_fakeUserIdentifier);
            _fakeUserFactory.CallsTo(x => x.GenerateUserIdentifierFromId(_userId)).Returns(_fakeUserIdentifier);

            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.CreateUserTimelineQueryParameters(It.IsAny<IUserIdentifier>(), It.IsAny<IUserTimelineParameters>()))
                                                .Returns(_fakeUserTimelineQueryParameters);

            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.CreateHomeTimelineParameters()).Returns(_fakeHomeTimelineParameters);
            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.CreateUserTimelineParameters()).Returns(_fakeUserTimelineParameters);
            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.CreateMentionsTimelineParameters()).Returns(_fakeMentionsTimelineParameters);
        }
Пример #40
0
        public void TestInitialize()
        {
            _fakeBuilder             = new FakeClassBuilder <TweetQueryExecutor>();
            _fakeTweetQueryGenerator = _fakeBuilder.GetFake <ITweetQueryGenerator>();
            _fakeTwitterAccessor     = _fakeBuilder.GetFake <ITwitterAccessor>();

            var fakeWebExceptionInfoExtractor = A.Fake <IWebExceptionInfoExtractor>();

            var twitter139ExceptionInfos = new TwitterExceptionInfo {
                Code = 139
            };

            fakeWebExceptionInfoExtractor.CallsTo(x => x.GetTwitterExceptionInfo(It.IsAny <WebException>())).Returns(new [] { twitter139ExceptionInfos });
            _fake139TwitterException = new TwitterException(fakeWebExceptionInfoExtractor, new WebException(), TestHelper.GenerateString());

            var twitterOtherExceptionInfos = new TwitterExceptionInfo {
                Code = 1
            };

            fakeWebExceptionInfoExtractor.CallsTo(x => x.GetTwitterExceptionInfo(It.IsAny <WebException>())).Returns(new[] { twitterOtherExceptionInfos });
            _fakeOtherTwitterException = new TwitterException(fakeWebExceptionInfoExtractor, new WebException(), TestHelper.GenerateString());
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder <TimelineQueryGenerator>();
            _fakeUserQueryParameterGenerator = _fakeBuilder.GetFake <IUserQueryParameterGenerator>();
            _fakeQueryParameterGenerator     = _fakeBuilder.GetFake <IQueryParameterGenerator>();
            _fakeUserQueryValidator          = _fakeBuilder.GetFake <IUserQueryValidator>();

            _fakeTimelineQueryParameterGenerator = _fakeBuilder.GetFake <ITimelineQueryParameterGenerator>();

            Init();

            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.GenerateExcludeRepliesParameter(It.IsAny <bool>())).Returns(_excludeRepliesParameter);
            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.GenerateIncludeContributorDetailsParameter(It.IsAny <bool>())).Returns(_includeContributorDetailsParameter);

            _fakeUserQueryParameterGenerator.CallsTo(x => x.GenerateIdOrScreenNameParameter(_fakeUserIdentifier, "user_id", "screen_name")).Returns(_userIdentifierParameter);
            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.GenerateIncludeRTSParameter(It.IsAny <bool>())).Returns(_includeRTSParameter);

            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateCountParameter(_maximumNumberOfTweetsParameterValue)).Returns(_maximumNumberOfTweetsParameter);
            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateTrimUserParameter(It.IsAny <bool>())).Returns(_trimUserParameter);
            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateSinceIdParameter(It.IsAny <long>())).Returns(_sinceIdParameter);
            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateMaxIdParameter(It.IsAny <long>())).Returns(_maxIdParameter);
            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateIncludeEntitiesParameter(It.IsAny <bool>())).Returns(_includeDetailsParameter);
        }
Пример #42
0
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder <SearchQueryGenerator>();
            _fakeSearchQueryValidator          = _fakeBuilder.GetFake <ISearchQueryValidator>();
            _fakeSearchQueryParameterGenerator = _fakeBuilder.GetFake <ISearchQueryParameterGenerator>();
            _fakeQueryParameterGenerator       = _fakeBuilder.GetFake <IQueryParameterGenerator>();

            InitData();

            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateSearchQueryParameter(_searchQuery)).Returns(_searchQueryParameter);
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateSearchTypeParameter(_searchResultType)).Returns(_searchTypeParameter);
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateSinceParameter(_since)).Returns(_sinceParameter);
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateUntilParameter(_until)).Returns(_untilParameter);
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateLocaleParameter(_locale)).Returns(_localeParameter);
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateLangParameter(_lang)).Returns(_languageParameter);
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateGeoCodeParameter(_geoCode)).Returns(_geoCodeParameter);

            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateCountParameter(_maximumNumberOfResults)).Returns(_maximumNumberOfResultsParameter);
            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateSinceIdParameter(_sinceId)).Returns(_sinceIdParameter);
            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateMaxIdParameter(_maxId)).Returns(_maxIdParameter);

            _fakeSearchQueryValidator.CallsTo(x => x.IsSearchQueryValid(It.IsAny <string>())).Returns(true);
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<TimelineQueryGenerator>();
            _fakeUserQueryParameterGenerator = _fakeBuilder.GetFake<IUserQueryParameterGenerator>();
            _fakeQueryParameterGenerator = _fakeBuilder.GetFake<IQueryParameterGenerator>();
            _fakeUserQueryValidator = _fakeBuilder.GetFake<IUserQueryValidator>();
            
            _fakeTimelineQueryParameterGenerator = _fakeBuilder.GetFake<ITimelineQueryParameterGenerator>();

            Init();

            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.GenerateExcludeRepliesParameter(It.IsAny<bool>())).Returns(_excludeRepliesParameter);
            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.GenerateIncludeContributorDetailsParameter(It.IsAny<bool>())).Returns(_includeContributorDetailsParameter);

            _fakeUserQueryParameterGenerator.CallsTo(x => x.GenerateIdOrScreenNameParameter(_fakeUserIdentifier, "user_id", "screen_name")).Returns(_userIdentifierParameter);
            _fakeTimelineQueryParameterGenerator.CallsTo(x => x.GenerateIncludeRTSParameter(It.IsAny<bool>())).Returns(_includeRTSParameter);
            
            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateCountParameter(_maximumNumberOfTweetsParameterValue)).Returns(_maximumNumberOfTweetsParameter);
            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateTrimUserParameter(It.IsAny<bool>())).Returns(_trimUserParameter);
            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateSinceIdParameter(It.IsAny<long>())).Returns(_sinceIdParameter);
            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateMaxIdParameter(It.IsAny<long>())).Returns(_maxIdParameter);
            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateIncludeEntitiesParameter(It.IsAny<bool>())).Returns(_includeDetailsParameter);
        }
Пример #44
0
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder <SearchQueryExecutor>();
            _fakeSearchQueryGenerator          = _fakeBuilder.GetFake <ISearchQueryGenerator>();
            _fakeSearchQueryHelper             = _fakeBuilder.GetFake <ISearchQueryHelper>();
            _fakeTwitterAccessor               = _fakeBuilder.GetFake <ITwitterAccessor>();
            _fakeTweetHelper                   = _fakeBuilder.GetFake <ITweetHelper>();
            _fakeSearchQueryParameterGenerator = _fakeBuilder.GetFake <ISearchQueryParameterGenerator>();

            _searchQuery      = TestHelper.GenerateString();
            _httpQuery        = TestHelper.GenerateString();
            _statusesJson     = TestHelper.GenerateString();
            _originalTweetDTO = GenerateTweetDTO(true);
            _retweetDTO       = GenerateTweetDTO(false);

            _jObject             = new JObject();
            _jObject["statuses"] = _statusesJson;
            _tweetDTOs           = new[] { A.Fake <ITweetWithSearchMetadataDTO>() };
            _searchResultDTO     = A.Fake <ISearchResultsDTO>();
            _searchResultDTO.CallsTo(x => x.TweetDTOs).Returns(_tweetDTOs);

            _tweetSearchParameter = A.Fake <ITweetSearchParameters>();
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.CreateSearchTweetParameter(_searchQuery)).Returns(_tweetSearchParameter);
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<SearchQueryExecutor>();
            _fakeSearchQueryGenerator = _fakeBuilder.GetFake<ISearchQueryGenerator>();
            _fakeSearchQueryHelper = _fakeBuilder.GetFake<ISearchQueryHelper>();
            _fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();
            _fakeTweetHelper = _fakeBuilder.GetFake<ITweetHelper>();
            _fakeSearchQueryParameterGenerator = _fakeBuilder.GetFake<ISearchQueryParameterGenerator>();

            _searchQuery = TestHelper.GenerateString();
            _httpQuery = TestHelper.GenerateString();
            _statusesJson = TestHelper.GenerateString();
            _originalTweetDTO = GenerateTweetDTO(true);
            _retweetDTO = GenerateTweetDTO(false);

            _jObject = new JObject();
            _jObject["statuses"] = _statusesJson;
            _tweetDTOs = new[] { A.Fake<ITweetWithSearchMetadataDTO>() };
            _searchResultDTO = A.Fake<ISearchResultsDTO>();
            _searchResultDTO.CallsTo(x => x.TweetDTOs).Returns(_tweetDTOs);

            _tweetSearchParameter = A.Fake<ITweetSearchParameters>();
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.CreateSearchTweetParameter(_searchQuery)).Returns(_tweetSearchParameter);
        }
        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<SearchQueryGenerator>();
            _fakeSearchQueryValidator = _fakeBuilder.GetFake<ISearchQueryValidator>();
            _fakeSearchQueryParameterGenerator = _fakeBuilder.GetFake<ISearchQueryParameterGenerator>();
            _fakeQueryParameterGenerator = _fakeBuilder.GetFake<IQueryParameterGenerator>();

            InitData();

            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateSearchQueryParameter(_searchQuery)).Returns(_searchQueryParameter);
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateSearchTypeParameter(_searchResultType)).Returns(_searchTypeParameter);
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateSinceParameter(_since)).Returns(_sinceParameter);
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateUntilParameter(_until)).Returns(_untilParameter);
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateLocaleParameter(_locale)).Returns(_localeParameter);
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateLangParameter(_lang)).Returns(_languageParameter);
            _fakeSearchQueryParameterGenerator.CallsTo(x => x.GenerateGeoCodeParameter(_geoCode)).Returns(_geoCodeParameter);

            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateCountParameter(_maximumNumberOfResults)).Returns(_maximumNumberOfResultsParameter);
            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateSinceIdParameter(_sinceId)).Returns(_sinceIdParameter);
            _fakeQueryParameterGenerator.CallsTo(x => x.GenerateMaxIdParameter(_maxId)).Returns(_maxIdParameter);

            _fakeSearchQueryValidator.CallsTo(x => x.IsSearchParameterValid(It.IsAny<ITweetSearchParameters>())).Returns(true);
            _fakeSearchQueryValidator.CallsTo(x => x.IsSearchTweetsQueryValid(It.IsAny<string>())).Returns(true);
        }
Пример #47
0
 public void TestInitialize()
 {
     _fakeBuilder             = new FakeClassBuilder <SearchController>();
     _fakeSearchQueryExecutor = _fakeBuilder.GetFake <ISearchQueryExecutor>();
     _fakeTweetFactory        = _fakeBuilder.GetFake <ITweetFactory>();
 }
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<GeoQueryExecutor>();
     _fakeGeoQueryGenerator = _fakeBuilder.GetFake<IGeoQueryGenerator>();
     _fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();
 }
Пример #49
0
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<UserQueryValidator>();
 }
Пример #50
0
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<MessageJsonController>();
     _fakeMessageQueryGenerator = _fakeBuilder.GetFake<IMessageQueryGenerator>();
     _fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();
 }
Пример #51
0
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<SavedSearchJsonController>();
     _fakeSavedSearchQueryGenerator = _fakeBuilder.GetFake<ISavedSearchQueryGenerator>();
     _fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();
 }
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<UserQueryParameterGenerator>();
     _fakeUserQueryValidator = _fakeBuilder.GetFake<IUserQueryValidator>();
 }
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<SavedSearchQueryGenerator>();
 }
Пример #54
0
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<WebHelper>();
     _fakeTweetinviSettingsAccessor = _fakeBuilder.GetFake<ITweetinviSettingsAccessor>();
     _fakeTweetinviSettingsAccessor.CallsTo(x => x.HttpRequestTimeout).Returns(10000);
 }
Пример #55
0
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<Tweet>();
 }
 public void TestInitialize()
 {
     _fakeBuilder            = new FakeClassBuilder <MessageQueryValidator>();
     _fakeUserQueryValidator = _fakeBuilder.GetFake <IUserQueryValidator>();
     _fakeUserQueryValidator.ArrangeIsUserIdValid();
 }
Пример #57
0
 public TweetControllerTests()
 {
     _fakeBuilder                     = new FakeClassBuilder <TweetController>();
     _fakeTweetQueryExecutor          = _fakeBuilder.GetFake <ITweetQueryExecutor>().FakedObject;
     _fakePageCursorIteratorFactories = _fakeBuilder.GetFake <IPageCursorIteratorFactories>().FakedObject;
 }
Пример #58
0
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder <MessageQueryExecutor>();
     _fakeMessageQueryGenerator = _fakeBuilder.GetFake <IMessageQueryGenerator>();
     _fakeTwitterAccessor       = _fakeBuilder.GetFake <ITwitterAccessor>();
 }
Пример #59
0
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder <Tweet>();
 }
Пример #60
0
 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<HelpController>();
     _fakeHelpQueryExecutor = _fakeBuilder.GetFake<IHelpQueryExecutor>();
 }