public void CanGetEntrySummaries() { // Establish Context IList<EntryDto> entrySummariesToExpect = new List<EntryDto>(); EntryDto entryDto = new EntryDto(); entrySummariesToExpect.Add(entryDto); entryRepository.Expect(r => r.GetEntrySummaries()) .Return(entrySummariesToExpect); // Act IList<EntryDto> entrySummariesRetrieved = entryManagementService.GetEntrySummaries(); // Assert entrySummariesRetrieved.ShouldNotBeNull(); entrySummariesRetrieved.Count.ShouldEqual(1); entrySummariesRetrieved[0].ShouldNotBeNull(); entrySummariesRetrieved[0].ShouldEqual(entryDto); }
public void CanListEntries() { // Establish Context IList<EntryDto> entrySummariesToExpect = new List<EntryDto>(); EntryDto entryDto = new EntryDto(); entrySummariesToExpect.Add(entryDto); entryManagementService.Expect(r => r.GetEntrySummaries()) .Return(entrySummariesToExpect); // Act ViewResult result = entriesController.Index().AssertViewRendered(); // Assert result.ViewData.Model.ShouldNotBeNull(); (result.ViewData.Model as IList<EntryDto>).ShouldNotBeNull(); (result.ViewData.Model as IList<EntryDto>).Count.ShouldEqual(1); }