Exemple #1
0
        public void GetUserFeeds_Returns_5_Feeds_For_jammus()
        {
            // Arrange
            FeedService feedService = new FeedService(new FakeFeedRepository());

            // Act
            var feeds = feedService.GetUsersFeeds("jammus");

            // Assert
            Assert.AreEqual(5, feeds.Count);
        }
Exemple #2
0
        public void Delete_Feed_Should_Remove_Feed_From_DataStore()
        {
            // Arrange
            FeedService feedService = new FeedService(new FakeFeedRepository());
            Feed feed = feedService.GetUsersFeed(1, "jammus");

            // Act
            feedService.Delete(feed);
            feed = feedService.GetUsersFeed(1, "jammus");
            var feeds = feedService.GetUsersFeeds("jammus");

            // Assert
            Assert.IsNull(feed);
            Assert.AreEqual(4, feeds.Count);
        }
Exemple #3
0
        public void Save_Existing_Feed_Should_Update_Feed_And_Keep_Total_Feeds_Unchanged()
        {
            // Arrange
            FeedService feedService = new FeedService(new FakeFeedRepository());
            Feed existingFeed = feedService.GetUsersFeed(1, "jammus");

            // Act
            existingFeed.Name = "Updated feed";
            feedService.Save(existingFeed);
            existingFeed = feedService.GetUsersFeed(1, "jammus");
            var feeds = feedService.GetUsersFeeds("jammus");

            // Assert
            Assert.AreEqual("Updated feed", existingFeed.Name);
            Assert.AreEqual(5, feeds.Count);
        }
Exemple #4
0
        public void Save_New_Feed_Should_Increase_Total_Feeds_By_1()
        {
            // Arrange
            FeedService feedService = new FeedService(new FakeFeedRepository());
            Feed newFeed = new Feed()
            {
                Name = "New Feed",
                UserName = "******",
                Url = "http://www.example.com/feed/"
            };

            // Act
            feedService.Save(newFeed);
            var feeds = feedService.GetUsersFeeds("jammus");

            // Assert
            Assert.AreEqual(6, feeds.Count);
        }
Exemple #5
0
 public FeedController(FeedService feedService, IFeedLoader feedLoader)
 {
     FeedService = feedService;
     FeedLoader = feedLoader;
 }
Exemple #6
0
 public FeedController(FeedService feedService)
     : this(feedService, new RemoteFeedLoader())
 {
 }
 FeedController CreateFeedController()
 {
     var feedService = new FeedService(new FakeFeedRepository());
     var feedLoader = new FakeFeedLoader();
     return new FeedController(feedService, feedLoader);
 }