public void GetAll_ShouldReturnAnICollectionOfWorkoutInformation() { var workoutInformationRepoStub = new Mock <IEfRepostory <WorkoutInformation> >(); var unitOfWorkStub = new Mock <IUnitOfWork>(); var dbSetStub = new Mock <IList <WorkoutInformation> >().As <IQueryable <WorkoutInformation> >(); var sut = new WorkoutInformationService(workoutInformationRepoStub.Object, unitOfWorkStub.Object); workoutInformationRepoStub.Setup(x => x.All).Returns(dbSetStub.Object); var result = sut.GetAll(); Assert.IsInstanceOf(typeof(ICollection <WorkoutInformation>), result); }
public void GetAll_ShouldCallWorkoutInformationRepoAllPropertyOnce() { var workoutInformationRepoStub = new Mock <IEfRepostory <WorkoutInformation> >(); var unitOfWorkStub = new Mock <IUnitOfWork>(); var dbSetStub = new List <WorkoutInformation>().AsQueryable(); var sut = new WorkoutInformationService(workoutInformationRepoStub.Object, unitOfWorkStub.Object); workoutInformationRepoStub.Setup(x => x.All).Returns(dbSetStub); var result = sut.GetAll(); workoutInformationRepoStub.Verify(x => x.All, Times.Once); }