public HttpResponseMessage StartWorkout(WorkoutActive wa) { WorkoutActive activeWorkout = new WorkoutActive(); WorkoutCollection result = new WorkoutCollection(); try { activeWorkout.workout_id = wa.workout_id; activeWorkout.start_date = wa.start_date; activeWorkout.start_time = wa.start_time; activeWorkout.status = false; var input = Helper.CastObject <workout_active>(activeWorkout); _workoutService.StartWorkout(input); var res = _workoutService.GetWorkout(activeWorkout.workout_id); MapCollection(res, ref result); } catch (Exception ex) { _logManager.WriteLog(ex); } return(ToJson(result)); }
public void B_StartWorkoutTest() { int wId = workoutCollectionService.GetWorkouts().Where(x => x.workout_title.Equals("TestServiceWorkout", StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefault().workout_id; workout_active wa = new workout_active() { workout_id = wId, start_date = DateTime.UtcNow.Date, start_time = DateTime.UtcNow.TimeOfDay, status = false }; workoutCollectionService.StartWorkout(wa); var result = workoutCollectionService.GetActiveWorkouts(wId).ToList(); Assert.AreNotEqual(null, result); Assert.AreNotEqual(0, result.Count()); Assert.AreEqual(false, wa.status); Assert.AreEqual(null, wa.comment); Assert.AreNotEqual(null, wa.start_date); Assert.AreNotEqual(null, wa.start_time); Assert.AreEqual(null, wa.end_date); Assert.AreEqual(null, wa.end_time); }