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); }
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); }
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); }
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); }
public FeedController(FeedService feedService, IFeedLoader feedLoader) { FeedService = feedService; FeedLoader = feedLoader; }
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); }