コード例 #1
0
        public void C_EndWorkoutTest()
        {
            var wc = wcRepository.GetAll().Where(x => x.workout_title.Equals("TestRepositoryWorkout", StringComparison.InvariantCultureIgnoreCase))
                     .FirstOrDefault();
            var            result = wcRepository.GetActiveWorkouts(wc.workout_id).ToList();
            workout_active wa     = new workout_active()
            {
                workout_id = wc.workout_id,
                sid        = result.LastOrDefault().sid,
                start_date = result.FirstOrDefault().start_date,
                start_time = result.FirstOrDefault().start_time,
                end_date   = DateTime.UtcNow.Date,
                end_time   = DateTime.UtcNow.TimeOfDay,
                comment    = "Ended",
                status     = true,
            };
            var result1 = wcRepository.GetActiveWorkouts(wc.workout_id).ToList();

            wcRepository.EndWorkout(wa);
            _context.SaveChanges();
            Assert.AreNotEqual(null, result);
            Assert.AreNotEqual(0, result.Count());
            Assert.AreEqual(true, result1.FirstOrDefault().status);
            Assert.AreNotEqual(null, result1.FirstOrDefault().comment);
            Assert.AreNotEqual(null, result1.FirstOrDefault().end_date);
            Assert.AreNotEqual(null, result1.FirstOrDefault().end_time);
        }
コード例 #2
0
 public void EndWorkout(workout_active wa)
 {
     workoutCollectionRepository.EndWorkout(wa);
     unitOfWork.Commit();
 }