public void Update_ShouldThrowWhenInvalidPendingWorkoutIsPassed() { var pendingWorkoutsStub = new Mock <IEfRepostory <PendingWorkout> >(); var unitOfWorkStub = new Mock <IUnitOfWork>(); var sut = new PendingWorkoutService(pendingWorkoutsStub.Object, unitOfWorkStub.Object); pendingWorkoutsStub.Setup(x => x.Update(It.IsAny <PendingWorkout>())); unitOfWorkStub.Setup(x => x.Commit()); Assert.Throws <ArgumentException>(() => sut.Update(null)); }
public void Update_ShouldCallUnitOfWorkCommitOnce() { var pendingWorkoutsStub = new Mock <IEfRepostory <PendingWorkout> >(); var unitOfWorkStub = new Mock <IUnitOfWork>(); var sut = new PendingWorkoutService(pendingWorkoutsStub.Object, unitOfWorkStub.Object); pendingWorkoutsStub.Setup(x => x.Update(It.IsAny <PendingWorkout>())); unitOfWorkStub.Setup(x => x.Commit()); var workout = new PendingWorkout(); sut.Update(workout); unitOfWorkStub.Verify(x => x.Commit(), Times.Once); }