예제 #1
0
        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());
        }
예제 #2
0
        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());
        }
예제 #3
0
        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);
        }