protected virtual void SetupStubs()
        {
            _webClient.Stub(client => client.OpenRead(_syncItem.EpisodeUrl)).Return(_stream);
            _webClientFactory.Stub(factory => factory.CreateWebClient()).Return(_webClient);
            _directoryInfoProvider.Stub(dir => dir.GetDirectoryInfo(_downloadFolder)).Return(_directoryInfo);
            _stateProvider.Stub(provider => provider.GetState(_syncItem.StateKey)).Return(_state);

            _counterFactory.Stub(
                factory => factory.CreateAverageCounter(CategoryInstaller.PodcastUtilitiesCommonCounterCategory,
                                                        CategoryInstaller.AverageMBDownload,
                                                        CategoryInstaller.SizeOfDownloads))
            .Return(_averageCounterSize);
            _counterFactory.Stub(
                factory => factory.CreateAverageCounter(CategoryInstaller.PodcastUtilitiesCommonCounterCategory,
                                                        CategoryInstaller.AverageTimeToDownload,
                                                        CategoryInstaller.NumberOfDownloads))
            .Return(_averageCounterTime);
        }
        protected virtual void SetupStubs(bool throwErrorFromFeed)
        {
            _timeProvider.Stub(time => time.UtcNow).Return(_now);
            _webClient.Stub(client => client.OpenRead(_feedInfo.Address)).Return(_stream);
            _webClientFactory.Stub(factory => factory.CreateWebClient()).Return(_webClient);
            _feedFactory.Stub(factory => factory.CreatePodcastFeed(_feedInfo.Format.Value, _stream, null)).Return(_podcastFeed);
            if (throwErrorFromFeed)
            {
                _podcastFeed.Stub(feed => feed.Episodes).Throw(new Exception("ERROR"));
            }
            else
            {
                _podcastFeed.Stub(feed => feed.Episodes).Return(_podcastFeedItems);
            }
            _stateProvider.Stub(provider => provider.GetState(Path.Combine(_rootFolder, _podcastInfo.Folder))).Return(_state);
            _directoryInfoProvider.Stub(dir => dir.GetDirectoryInfo(Path.Combine(_rootFolder, _podcastInfo.Folder))).Return(_directoryInfo);

            _commandGenerator.Stub(cmd => cmd.ReplaceTokensInCommand(null, _rootFolder, null, _podcastInfo)).IgnoreArguments().Return(_externalCommand);
        }
 public void SetUp()
 {
     _webClientFactory = Create.Stub <IWebClientFactory>();
     _webClient        = Create.Mock <IWebClient>();
     _webClientFactory.Stub(w => w.GetWebClient(Arg <string> .Is.Anything)).Return(_webClient);
 }
 public void SetUp()
 {
     _webClientFactory = MockRepository.GenerateStub<IWebClientFactory>();
     _webClient = MockRepository.GenerateMock<IWebClient>();
     _webClientFactory.Stub(w => w.GetWebClient(Arg<string>.Is.Anything, "dummy", "dummy")).Return(_webClient);
 }
 public void SetUp()
 {
     _factory = MockRepository.GenerateStub<IWebClientFactory>();
     _responseDecoder = MockRepository.GenerateStub<IResponseDecoder>();
     _webClient = MockRepository.GenerateStub<WebClient>();
     _factory.Stub(f => f.Create()).Return(_webClient);
     _webClient.Headers = new WebHeaderCollection();
 }
 public void SetUp()
 {
     _webClientFactory = Create.Stub<IWebClientFactory>();
     _webClient = Create.Mock<IWebClient>();
     _webClientFactory.Stub(w => w.GetWebClient(Arg<string>.Is.Anything)).Return(_webClient);
 }