public void C_EndWorkoutTest()
        {
            var wc = workoutCollectionService.GetWorkouts().Where(x => x.workout_title.Equals("TestServiceWorkout", StringComparison.InvariantCultureIgnoreCase))
                     .FirstOrDefault();
            var            result = workoutCollectionService.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 = workoutCollectionService.GetActiveWorkouts(wc.workout_id).ToList().Where(a => a.sid == wa.sid);

            workoutCollectionService.EndWorkout(wa);
            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);
        }
        public HttpResponseMessage EndWorkout(WorkoutActive wa)
        {
            WorkoutActive     activeWorkout = new WorkoutActive();
            WorkoutCollection result        = new WorkoutCollection();

            try
            {
                activeWorkout.sid        = wa.sid;
                activeWorkout.workout_id = wa.workout_id;
                activeWorkout.start_date = wa.start_date;
                activeWorkout.start_time = wa.start_time;
                activeWorkout.end_date   = wa.end_date;
                activeWorkout.end_time   = wa.end_time;
                activeWorkout.comment    = wa.comment;
                activeWorkout.status     = true;
                var input = Helper.CastObject <workout_active>(activeWorkout);
                _workoutService.EndWorkout(input);
                var res = _workoutService.GetWorkout(activeWorkout.workout_id);
                MapCollection(res, ref result);
            }
            catch (Exception ex)
            {
                _logManager.WriteLog(ex);
            }
            return(ToJson(result));
        }