Ejemplo n.º 1
0
        public void Update_ShouldThrowWhenInvalidWorkoutInformationIsPassed()
        {
            var workoutInformationRepoStub = new Mock <IEfRepostory <WorkoutInformation> >();
            var unitOfWorkStub             = new Mock <IUnitOfWork>();

            var sut = new WorkoutInformationService(workoutInformationRepoStub.Object, unitOfWorkStub.Object);

            workoutInformationRepoStub.Setup(x => x.Update(It.IsAny <WorkoutInformation>()));
            unitOfWorkStub.Setup(x => x.Commit());

            Assert.Throws <ArgumentException>(() => sut.Update(null));
        }
Ejemplo n.º 2
0
        public void Update_ShouldCallUnitOfWorkCommitOnce()
        {
            var workoutInformationRepoStub = new Mock <IEfRepostory <WorkoutInformation> >();
            var unitOfWorkStub             = new Mock <IUnitOfWork>();

            var sut = new WorkoutInformationService(workoutInformationRepoStub.Object, unitOfWorkStub.Object);

            workoutInformationRepoStub.Setup(x => x.Update(It.IsAny <WorkoutInformation>()));
            unitOfWorkStub.Setup(x => x.Commit());

            var workout = new WorkoutInformation();

            sut.Update(workout);

            unitOfWorkStub.Verify(x => x.Commit(), Times.Once);
        }