public void Get_NoBlogEntriesInRepository_EmptyListReturned()
        {
            var repository = MockRepository.GenerateStub<IBlogEntryRepository>();
            repository.Stub(repo => repo.Get()).Return(new List<BlogEntry>());
            var blogEntryController = new BlogEntryController(repository);

            var entries = blogEntryController.Get();

            Assert.AreEqual(0, entries.Count());
        }
        public void Get_OneBlogEntryInRepository_ReturnedListContainsBlogEntryFromRepository()
        {
            var repository = MockRepository.GenerateStub<IBlogEntryRepository>();
            repository.Stub(repo => repo.Get()).Return(new List<BlogEntry> { new BlogEntry() });

            var blogEntryController = new BlogEntryController(repository);

            var entries = blogEntryController.Get();

            Assert.AreEqual(1, entries.Count());
        }
        public void Get_OneBlogEntryWithId1_BlogEntryReturned()
        {
            var repository = MockRepository.GenerateStub<IBlogEntryRepository>();
            repository.Stub(repo => repo.Get()).Return(new List<BlogEntry> { new BlogEntry { Id = 1 } });

            var blogEntryController = new BlogEntryController(repository);

            var blogEntry = blogEntryController.Get(1);

            Assert.AreEqual(1, blogEntry.Id);
        }
 private static BlogEntryController CreateController(IBlogEntryRepository mockedRepository)
 {
     var request = new HttpRequestMessage();
     request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
     var blogEntryController = new BlogEntryController(mockedRepository) { Request = request };
     return blogEntryController;
 }