Beispiel #1
0
        public void MarkPendingAsCompleted_ShouldThrowWhenInvalidWorkoutIsPassed()
        {
            var pendingWorkoutsStub = new Mock <IEfRepostory <PendingWorkout> >();
            var unitOfWorkStub      = new Mock <IUnitOfWork>();

            var sut = new PendingWorkoutService(pendingWorkoutsStub.Object, unitOfWorkStub.Object);

            Assert.Throws <ArgumentException>(() => sut.MarkPendingAsCompleted(null));
        }
Beispiel #2
0
        public void MarkPendingAsCompleted_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.MarkPendingAsCompleted(workout);

            unitOfWorkStub.Verify(x => x.Commit(), Times.Once);
        }
Beispiel #3
0
        public void MarkPendingAsCompleted_ShouldMarkTheWorkoutAsCompleted()
        {
            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.MarkPendingAsCompleted(workout);

            Assert.AreEqual(true, workout.IsCompleted);
        }