public void ShouldRetrieveADifferentListOfQuotesFromRepository() { // Given IList<int> quotes = new List<int>{1,2,3}; IQuotesRepository repository = new StubQuotesRepository(quotes); var controller = new QuotesController(repository); // When var model = (QuotesModel)((ViewResult) controller.Index()).Model; // Then Assert.That(model.Quotes, Is.EqualTo(quotes)); }
public void ShouldRetrieveQuotesFromRepository() { // Given IList<int> quotes = new List<int>{5,4,3}; IQuotesRepository repository = new StubQuotesRepository(quotes); var controller = new QuotesController(repository); repository.Expect(r=> r.FindAll()).Return(quotes); // When var model = (QuotesModel)((ViewResult) controller.Index()).Model; // Then Assert.That(model.Quotes, Is.EqualTo(quotes)); }