Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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);
        }