public void Throw_WhenIdIsNull() { //Arrange var mockedUserRepository = new Mock <IEFGenericRepository <ApplicationUser> >(); var mockedToDoListModelRepository = new Mock <IEFGenericRepository <ToDoListModel> >(); var mockedUnitOfWork = new Mock <IUnitOfWork>(); var toDoListModelService = new ToDoList.Services.ToDoListModelService(mockedToDoListModelRepository.Object, mockedUserRepository.Object, mockedUnitOfWork.Object); //Act&Assert Assert.Throws <ArgumentNullException>(() => { toDoListModelService.UpdateToDoList(null); }); }
public void CallRepositoryUpdate_OnlyOnce() { //Arrange var mockedUserRepository = new Mock <IEFGenericRepository <ApplicationUser> >(); var mockedToDoListModelRepository = new Mock <IEFGenericRepository <ToDoListModel> >(); var mockedUnitOfWork = new Mock <IUnitOfWork>(); var mockedToDoList = new Mock <ToDoListModel>(); var toDoListModelService = new ToDoList.Services.ToDoListModelService(mockedToDoListModelRepository.Object, mockedUserRepository.Object, mockedUnitOfWork.Object); //Act toDoListModelService.UpdateToDoList(mockedToDoList.Object); //Assert mockedToDoListModelRepository.Verify(x => x.Update(It.IsAny <ToDoListModel>()), Times.Once); }