Exemple #1
0
 protected override void Given()
 {
     base.Given();
     User = "******";
     RequestQueue = new Mock<ITwitterRequestQueue>();
     var responseQueue = new Mock<ITwitterResponseQueue>();
     RecentFriendRegistry = new Mock<IRecentFriendRegistry>();
     ControllerUnderTest = new CrawlerController(null, RequestQueue.Object, responseQueue.Object, RecentFriendRegistry.Object);
 }
        public void Request_Is_Retried()
        {
            // arrange
            var userWriter = new Mock<IUserWriter>();
            var requestQueue = new MockRequestQueue();
            var responseQueue = new MockResponseQueue();
            var controller = new CrawlerController(userWriter.Object, requestQueue, responseQueue, new RecentFriendRegistry());
            var retryRequest = new GetFriendsRequest("test");
            var errorResponse = new ErrorResponse(retryRequest, "fail whale");

            // act
            controller.ProcessResponse(errorResponse);

            // assert
            Assert.That(requestQueue.QueuedMessages, Has.Count(1));
            Assert.That(requestQueue.QueuedMessages.Single(), Is.SameAs(retryRequest));
        }