public void FindInactiveRssFeeds_RssReaderErrorGetThrown_ExceptionThrown() { DateTimeOffset inactiveDate1 = DateTimeOffset.Now.AddHours(-21); DateTimeOffset inactiveDate2 = DateTimeOffset.Now.AddHours(-21); string companyName1 = "Fake Company"; string companyName2 = "Other Company"; var mock = new Mock <IRssReader>(); mock.Setup(r => r.LoadRssFeed(It.IsAny <string>())).Returns(true); mock.SetupSequence(r => r.MostRecentItemPublished) .Returns(inactiveDate1) .Returns(inactiveDate1) .Throws(new Exception("This is a fake error")); mock.Setup(r => r.IsLoaded).Returns(true); mockReader = mock.Object; IRssActivityMonitor monitor = new ActivityMonitor(mockReader); Dictionary <string, List <string> > inputRssFeeds = new Dictionary <string, List <string> >(); inputRssFeeds.Add(companyName1, new List <string>() { "http://fake.feed.xml" }); inputRssFeeds.Add(companyName2, new List <string>() { "http://fake.second-feed.xml" }); List <string> InactiveCompanies = monitor.FindInactiveRssFeeds(inputRssFeeds, 1, false); Assert.Fail("Exeption should have been raised prior to this point"); }
public Utilities(IRssReader reader, ISettingsService settings, ITorrentDownloader td, IFilterFeed filter) { RssReader = reader; Settings = settings; TorrentDownloader = td; Filter = filter; }
public void FindInactiveRssFeeds_CompanyWith1InactiveFeed_ReturnCompanyInList() { DateTimeOffset inactiveDate = DateTimeOffset.Now.AddHours(-25); string companyName = "Fake Company"; var mock = new Mock <IRssReader>(); mock.Setup(r => r.LoadRssFeed(It.IsAny <string>())).Returns(true); mock.Setup(r => r.MostRecentItemPublished).Returns(inactiveDate); mock.SetupSequence(r => r.IsLoaded) .Returns(false) .Returns(true); mockReader = mock.Object; IRssActivityMonitor monitor = new ActivityMonitor(mockReader); Dictionary <string, List <string> > inputRssFeeds = new Dictionary <string, List <string> >(); inputRssFeeds.Add(companyName, new List <string>() { "http://fake.feed.xml" }); List <string> InactiveCompanies = monitor.FindInactiveRssFeeds(inputRssFeeds); Assert.AreEqual(1, InactiveCompanies.Count); Assert.AreEqual(companyName, InactiveCompanies[0], false, "Company Name is not the correct value"); }
public void FindInactiveRssFeeds_ChangeDaysParamToTwo_ReturnListOfZero() { DateTimeOffset inactiveDate1 = DateTimeOffset.Now.AddHours(-26); DateTimeOffset inactiveDate2 = DateTimeOffset.Now.AddHours(-25); string companyName1 = "Fake Company"; string companyName2 = "Other Company"; var mock = new Mock <IRssReader>(); mock.Setup(r => r.LoadRssFeed(It.IsAny <string>())).Returns(true); mock.SetupSequence(r => r.MostRecentItemPublished) .Returns(inactiveDate1) .Returns(inactiveDate1) .Returns(inactiveDate2) .Returns(inactiveDate2); mock.Setup(r => r.IsLoaded).Returns(true); mockReader = mock.Object; IRssActivityMonitor monitor = new ActivityMonitor(mockReader); Dictionary <string, List <string> > inputRssFeeds = new Dictionary <string, List <string> >(); inputRssFeeds.Add(companyName1, new List <string>() { "http://fake.feed.xml" }); inputRssFeeds.Add(companyName2, new List <string>() { "http://fake.second-feed.xml" }); List <string> InactiveCompanies = monitor.FindInactiveRssFeeds(inputRssFeeds, 2); Assert.AreEqual(0, InactiveCompanies.Count); }
public void FindInactiveRssFeeds_CompanyWithMultipleFeedMixActivity_ReturnEmptyList() { DateTimeOffset activeDate = DateTimeOffset.Now.AddHours(-23); DateTimeOffset inactiveDate = DateTimeOffset.Now.AddHours(-25); string companyName = "Fake Company"; var mock = new Mock <IRssReader>(); mock.Setup(r => r.LoadRssFeed(It.IsAny <string>())).Returns(true); mock.SetupSequence(r => r.MostRecentItemPublished) .Returns(activeDate) .Returns(activeDate) .Returns(inactiveDate) .Returns(inactiveDate); mock.Setup(r => r.IsLoaded).Returns(true); mockReader = mock.Object; IRssActivityMonitor monitor = new ActivityMonitor(mockReader); Dictionary <string, List <string> > inputRssFeeds = new Dictionary <string, List <string> >(); inputRssFeeds.Add(companyName, new List <string>() { "http://fake.feed.xml", "http://fake.second-feed.xml" }); List <string> InactiveCompanies = monitor.FindInactiveRssFeeds(inputRssFeeds); Assert.AreEqual(0, InactiveCompanies.Count); }
public void FindInactiveRssFeeds_RssReaderErrorTreatAsInactive_ReturnListOfOne() { DateTimeOffset inactiveDate1 = DateTimeOffset.Now.AddHours(-21); DateTimeOffset inactiveDate2 = DateTimeOffset.Now.AddHours(-21); string companyName1 = "Fake Company"; string companyName2 = "Other Company"; var mock = new Mock <IRssReader>(); mock.Setup(r => r.LoadRssFeed(It.IsAny <string>())).Returns(true); mock.SetupSequence(r => r.MostRecentItemPublished) .Returns(inactiveDate1) .Returns(inactiveDate1) .Throws(new Exception("This is a fake error")); mock.Setup(r => r.IsLoaded).Returns(true); mockReader = mock.Object; IRssActivityMonitor monitor = new ActivityMonitor(mockReader); Dictionary <string, List <string> > inputRssFeeds = new Dictionary <string, List <string> >(); inputRssFeeds.Add(companyName1, new List <string>() { "http://fake.feed.xml" }); inputRssFeeds.Add(companyName2, new List <string>() { "http://fake.second-feed.xml" }); List <string> InactiveCompanies = monitor.FindInactiveRssFeeds(inputRssFeeds); Assert.AreEqual(1, InactiveCompanies.Count); }
public CategoryListViewModel(IThemeService themeService, IRssReader rssReader, IAsyncDownloadManager downloadManager, INavigationService navigationService, ILockscreenHelper lockscreen, IDownloadHelper downloadHelper) { _themeService = themeService; _rssReader = rssReader; _downloadManager = downloadManager; _navigationService = navigationService; _lockscreen = lockscreen; _downloadHelper = downloadHelper; AddMorePicturesCommand = Items.CountChanged .Select(_ => Items.Count < imageMetaData.Count()) .ToCommand(); AddMorePicturesCommand .RegisterAsyncTask(value => GetImages((int)value)); FullScreenCommand = new ReactiveCommand(); SetLockScreenCommand = new ReactiveCommand(); SetLockScreenCommand .RegisterAsyncTask(value => SetLockscreen(value as CategoryItem)); DownloadImageCommand = new ReactiveCommand(); DownloadImageCommand .RegisterAsyncTask(value => DownloadImage(value as CategoryItem)); }
private void bwRssReader_DoWork(Object pSender, DoWorkEventArgs pEventArgs) { cLogger.Info("Resolviendo instancia de IRssReader..."); IRssReader mRssReader = IoCContainerLocator.Container.Resolve <IRssReader>(); cLogger.Info("Obteniendo feeds..."); pEventArgs.Result = mRssReader.Read((Uri)pEventArgs.Argument); }
private void bwRssReader_DoWork(Object pSender, DoWorkEventArgs pEventArgs) { try { IRssReader mRssReader = IoCContainerLocator.Container.Resolve <IRssReader>(); pEventArgs.Result = mRssReader.Read((Uri)pEventArgs.Argument); } catch (System.Net.WebException) { } }
public NewsService(IUnitOfWork unitOfWork, IRssReader rssReader, IOnlinerParser onlinerParser, ITutByParser tutByParser, IS13Parser s13Parser) { _unitOfWork = unitOfWork; _rssReader = rssReader; _onlinerParser = onlinerParser; _tutByParser = tutByParser; _s13Parser = s13Parser; }
public RssToSiteCreatorFunction(IRssReader rssReader, ISiteCreator siteCreator, ISiteDeployer siteDeployer, IOptions <FunctionSettings> options) { this.rssReader = rssReader; this.siteCreator = siteCreator; this.siteDeployer = siteDeployer; // 環境変数を取得 // https://docs.microsoft.com/ja-jp/azure/azure-functions/functions-dotnet-dependency-injection#working-with-options-and-settings settings = options.Value; }
public RssTelegramBot(ITelegramBotApi api, IRssReader rssReader, int refreshIntervalSeconds = 600, int numWorkers = 10, int numRssUpdateWorkers = 10 ) : base(api, numWorkers) { _refreshInterval = TimeSpan.FromSeconds(refreshIntervalSeconds); _numRssUpdateWorkers = numRssUpdateWorkers; _rssReader = rssReader; }
public ImageDetailsViewModel(IThemeService themeService, IRssReader rssReader, IAsyncDownloadManager downloadManager) { _themeService = themeService; _rssReader = rssReader; _downloadManager = downloadManager; OnActivatedCommand = new ReactiveCommand(); OnActivatedCommand.RegisterAsyncTask(_ => OnActivated()); SetLockscreenCommand = new ReactiveCommand(); SetLockscreenCommand.RegisterAsyncTask(_ => SetLockscreen()); DownloadPhotoCommand = new ReactiveCommand(); DownloadPhotoCommand.RegisterAsyncTask(_ => DownloadPhoto()); }
public NewsService( IRssReader rssReader, IOnlinerNewsParser onlinerNewsParser, Is13NewsParser s13NewsParser, IUnitOfWork unitOfWork, ITutByNewsParser tutByNewsParser, IOptions <AppSettings> appSettings, INewsEvaluation newsEvaluation) { _rssReader = rssReader; _onlinerNewsParser = onlinerNewsParser; _s13NewsParser = s13NewsParser; _unitOfWork = unitOfWork; _tutByNewsParser = tutByNewsParser; _appSettings = appSettings.Value; _newsEvaluation = newsEvaluation; }
public MainPageViewModel(IThemeService themeService, IRssReader rssReader, IAsyncDownloadManager downloadManager, INavigationService navigationService, ILockscreenHelper lockscreenHelper, INotificationService notificationService) { _themeService = themeService; _rssReader = rssReader; _downloadManager = downloadManager; _navigationService = navigationService; _lockscreenHelper = lockscreenHelper; this._notificationService = notificationService; this.ObservableForProperty(vm => vm.SelectedCategory).Select(_ => _.GetValue()).Subscribe(NavigateToCategoryList); this.ObservableForProperty(vm => vm.SelectedTop4).Select(_ => _.GetValue()).Where(v => v != null).Subscribe(Top4Selected); }
public void FindInactiveRssFeeds_InputDictionaryEmpty_ReturnListOfZero() { DateTimeOffset inactiveDate = DateTimeOffset.Now.AddHours(-23); var mock = new Mock <IRssReader>(); mock.Setup(r => r.LoadRssFeed(It.IsAny <string>())).Returns(true); mock.Setup(r => r.MostRecentItemPublished).Returns(inactiveDate); mock.SetupSequence(r => r.IsLoaded) .Returns(false) .Returns(true); mockReader = mock.Object; IRssActivityMonitor monitor = new ActivityMonitor(mockReader); Dictionary <string, List <string> > inputRssFeeds = new Dictionary <string, List <string> >(); List <string> InactiveCompanies = monitor.FindInactiveRssFeeds(inputRssFeeds); Assert.AreEqual(0, InactiveCompanies.Count); }
public void FindInactiveRssFeeds_InputDictionaryNull_ExceptionThrown() { DateTimeOffset inactiveDate = DateTimeOffset.Now.AddHours(-23); var mock = new Mock <IRssReader>(); mock.Setup(r => r.LoadRssFeed(It.IsAny <string>())).Returns(true); mock.Setup(r => r.MostRecentItemPublished).Returns(inactiveDate); mock.SetupSequence(r => r.IsLoaded) .Returns(false) .Returns(true); mockReader = mock.Object; IRssActivityMonitor monitor = new ActivityMonitor(mockReader); Dictionary <string, List <string> > inputRssFeeds = null; List <string> InactiveCompanies = monitor.FindInactiveRssFeeds(inputRssFeeds); Assert.Fail("Exeption should have been raised prior to this point"); }
public DailyLinksViewModel(IRepository<DailyLinksContainer> repository, DateTime date, IRssReader webDevelopmentReader, IRssReader entityFrameworkReader, IRssReader visualStudioReader, IRssReader javascriptReader, IRssReader cleanCodeReader, IRssReader productivityReader, IRssReader unitTestingReader, IRssReader computerScienceReader, IRssReader functionalProgrammingReader, IRssReader computingTechnologyReader, IRssReader uncleBobReader) { Date = date; _repository = repository; _webDevelopmentReader = webDevelopmentReader; _entityFrameworkReader = entityFrameworkReader; _visualStudioReader = visualStudioReader; _javascriptReader = javascriptReader; _cleanCodeReader = cleanCodeReader; _productivityReader = productivityReader; _unitTestingReader = unitTestingReader; _computerScienceReader = computerScienceReader; _functionalProgrammingReader = functionalProgrammingReader; _computingTechnologyReader = computingTechnologyReader; _uncleBobReader = uncleBobReader; SetupData(); }
public HubViewModel(IThemeService themeService, IRssReader rssReader, IAsyncDownloadManager downloadManager, INavigationService navigationService) { _themeService = themeService; _rssReader = rssReader; _downloadManager = downloadManager; _navigationService = navigationService; OnActivateCommand = new ReactiveCommand(); OnActivateCommand.RegisterAsyncTask(_ => OnActivateWork()); WallpaperOfTheDayCommand = new ReactiveCommand(); WallpaperOfTheDayCommand.Subscribe(NavigateToDetailsForWallpaperOfTheDay); Top4Command = new ReactiveCommand(); Top4Command.Subscribe(NavigateToDetailsForTop4Item); CategoryCommand = new ReactiveCommand(); CategoryCommand.Subscribe(NavigateToCategoryList); //BlobCache.LocalMachine.Dispose(); this.updater = TileUpdateManager.CreateTileUpdaterForApplication(); updater.EnableNotificationQueue(true); }
public CategoryListViewModel(IThemeService themeService, IRssReader rssReader, IAsyncDownloadManager downloadManager, INavigationService navigationService) { this.themeService = themeService; this.rssReader = rssReader; this.downloadManager = downloadManager; this.navigationService = navigationService; OnActivateCommand = new ReactiveCommand(); OnActivateCommand.RegisterAsyncTask(_ => GetImages()); CategoryItemCommand = new ReactiveCommand(); CategoryItemCommand.Subscribe(item => { var categoryItem = item as CategoryItem; navigationService .UriFor<ImageDetailsViewModel>() .WithParam(x => x.Category, Category) .WithParam(x => x.Id, categoryItem.Id) .Navigate(); }); }
public void FindInactiveRssFeeds_TwoCompaniesOneInactive_ReturnListOfOne() { DateTimeOffset activeDate = DateTimeOffset.Now.AddHours(-23); DateTimeOffset inactiveDate = DateTimeOffset.Now.AddHours(-25); string companyName1 = "Fake Company"; string companyName2 = "Other Company"; var mock = new Mock <IRssReader>(); mock.Setup(r => r.LoadRssFeed(It.IsAny <string>())).Returns(true); mock.SetupSequence(r => r.MostRecentItemPublished) .Returns(activeDate) .Returns(activeDate) .Returns(inactiveDate) .Returns(inactiveDate); mock.Setup(r => r.IsLoaded).Returns(true); mockReader = mock.Object; IRssActivityMonitor monitor = new ActivityMonitor(mockReader); Dictionary <string, List <string> > inputRssFeeds = new Dictionary <string, List <string> >(); inputRssFeeds.Add(companyName1, new List <string>() { "http://fake.feed.xml" }); inputRssFeeds.Add(companyName2, new List <string>() { "http://fake.second-feed.xml" }); List <string> InactiveCompanies = monitor.FindInactiveRssFeeds(inputRssFeeds); Assert.AreEqual(1, InactiveCompanies.Count); Assert.IsTrue(InactiveCompanies.Contains(companyName2), "Company 2 should have been inactive"); Assert.IsFalse(InactiveCompanies.Contains(companyName1), "Company 1 should not have been inactive"); }
public SubscriptionsController(SubscriptionService subscriptionService, IRssReader rssReader) { _subscriptionService = subscriptionService; _rssReader = rssReader; }
/// <summary> /// Initializes a new instance of the <see cref="IRssReader"/> class using DI /// </summary> /// <param name="rssReader"></param> public WeatherController(IRssReader rssReader) { _rssReader = rssReader; }
private void SetupRssReaders() { _webDevelopmentReader = new RssReader(RssFeeds.WebDevelopment, new RssWebCaller(), Date); _entityFrameworkReader = new RssReader(RssFeeds.EntityFramework, new RssWebCaller(), Date); _visualStudioReader = new RssReader(RssFeeds.VisualStudio, new RssWebCaller(), Date); _javascriptReader = new RssReader(RssFeeds.Javascript, new RssWebCaller(), Date); _cleanCodeReader = new RssReader(RssFeeds.CleanCode, new RssWebCaller(), Date); _productivityReader = new RssReader(RssFeeds.Productivity, new RssWebCaller(), Date); _unitTestingReader = new RssReader(RssFeeds.UnitTesting, new RssWebCaller(), Date); _computerScienceReader = new RssReader(RssFeeds.ComputerScience, new RssWebCaller(), Date); _functionalProgrammingReader = new RssReader(RssFeeds.FunctionalProgrammingAndFSharp, new RssWebCaller(), Date); _computingTechnologyReader = new RssReader(RssFeeds.ComputingTechnology, new RssWebCaller(), Date); _uncleBobReader = new RssReader(RssFeeds.UncleBob, new RssWebCaller(), Date); }
private void bwRssReader_DoWork(Object pSender, DoWorkEventArgs pEventArgs) { IRssReader reRssReader = IoCContainerLocator.Container.Resolve <IRssReader>(); pEventArgs.Result = reRssReader.Read((Uri)pEventArgs.Argument); }
public ReceiverService(IApplicationDbContext database, IRssReader rssReader) { _database = database; _rssReader = rssReader; }
public FeedReader(IRssReader rssReader, IDailyHeilContextFactory contextFactory) { _rssReader = rssReader; _contextFactory = contextFactory; }
public RssController(IFeedReceiverRepository repository, INewsFeedSender feedSender, IRssReader rssReader) { this.repository = repository; this.feedSender = feedSender; this.rssReader = rssReader; }
public GetFeedsRequestHandler(IFeedOptionStore feedOptionsStore, IRssReader rssReader) { _feedOptionsStore = feedOptionsStore; _rssReader = rssReader; }
public ActivityMonitor(IRssReader rssReader) { this._reader = rssReader; }
public PaperWallRssParser(IRssReader rssReader) { // TODO: Complete member initialization this.rssReader = rssReader; }
private void bwRssReader_DoWork(object sender, DoWorkEventArgs e) { IRssReader mRssReader = IoCContainerLocator.Container.Resolve <IRssReader>(); e.Result = mRssReader.Read((Uri)e.Argument); }
public HomeController(IFeedReceiverRepository repository, IRssReader rssReader) { this.repository = repository; this.rssReader = rssReader; }