public void GetCategories_ShouldReturnInstanceOfSelectList() { //Arrange var mockSubmitFactory = new Mock <ISubmitFactory>(); var mockSubmissionRepository = new Mock <IRepository <Submission> >(); var mockCategoryRepository = new Mock <IRepository <Category> >(); var mockDateTimeProvider = new Mock <IDateTimeProvider>(); var mockUnitOfWork = new Mock <IUnitOfWork>(); var service = new SubmitService(mockSubmitFactory.Object, mockSubmissionRepository.Object, mockCategoryRepository.Object, mockDateTimeProvider.Object, mockUnitOfWork.Object ); //Act var categories = service.GetCategories(); //Assert Assert.IsInstanceOf <SelectList>(categories); }
public void GetCategories_ShouldCallCategoryRepositoryGetALl() { //Arrange var mockSubmitFactory = new Mock <ISubmitFactory>(); var mockSubmissionRepository = new Mock <IRepository <Submission> >(); var mockCategoryRepository = new Mock <IRepository <Category> >(); var mockDateTimeProvider = new Mock <IDateTimeProvider>(); var mockUnitOfWork = new Mock <IUnitOfWork>(); var service = new SubmitService(mockSubmitFactory.Object, mockSubmissionRepository.Object, mockCategoryRepository.Object, mockDateTimeProvider.Object, mockUnitOfWork.Object ); //Act service.GetCategories(); //Assert mockCategoryRepository.Verify(x => x.Entities, Times.Once); }