Exemplo n.º 1
0
        public void GetAll_ShouldReturnAnICollectionOfPendingWorkouts()
        {
            var pendingWorkoutsStub = new Mock <IEfRepostory <PendingWorkout> >();
            var unitOfWorkStub      = new Mock <IUnitOfWork>();
            var dbSetStub           = new Mock <IList <PendingWorkout> >().As <IQueryable <PendingWorkout> >();

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

            pendingWorkoutsStub.Setup(x => x.All).Returns(dbSetStub.Object);

            var result = sut.GetAll();

            Assert.IsInstanceOf(typeof(ICollection <PendingWorkout>), result);
        }
Exemplo n.º 2
0
        public void GetAll_ShouldCallPendingWorkoutsRepoAllPropertyOnce()
        {
            var pendingWorkoutsStub = new Mock <IEfRepostory <PendingWorkout> >();
            var unitOfWorkStub      = new Mock <IUnitOfWork>();
            var dbSetStub           = new List <PendingWorkout>().AsQueryable();

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

            pendingWorkoutsStub.Setup(x => x.All).Returns(dbSetStub);

            var result = sut.GetAll();

            pendingWorkoutsStub.Verify(x => x.All, Times.Once);
        }