public void IfNoOpenSessionExistsNullIsReturned() { var repo = new Mock<IWorkoutRepository>(); var service = new WorkoutService(repo.Object, null); repo.Setup(x => x.Where(It.IsAny<OpenWorkoutQuery>())).Returns(It.Is<IList<Workout>>(null)); var currentWorkout = service.CurrentWorkout(); currentWorkout.ShouldBeNull(); repo.VerifyAll(); }
public void IfAnOpenSessionExistsThenItIsReturned() { var repo = new Mock<IWorkoutRepository>(); var service = new WorkoutService(repo.Object, null); var workDoc = new List<Workout> { new Workout(new WorkoutDocument { Id = 1 }) }; repo.Setup(x => x.Where(It.IsAny<OpenWorkoutQuery>())).Returns(workDoc); var currentWorkout = service.CurrentWorkout(); currentWorkout.WorkoutId.ShouldEqual(1); repo.VerifyAll(); }