示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#5
0
 public FeedController(FeedService feedService, IFeedLoader feedLoader)
 {
     FeedService = feedService;
     FeedLoader = feedLoader;
 }
示例#6
0
 public FeedController(FeedService feedService)
     : this(feedService, new RemoteFeedLoader())
 {
 }
示例#7
0
 FeedController CreateFeedController()
 {
     var feedService = new FeedService(new FakeFeedRepository());
     var feedLoader = new FakeFeedLoader();
     return new FeedController(feedService, feedLoader);
 }