public given()
 {
     _scorecardService = new ScorecardService();
     _scorecardService.Save(new WorkoutStarted
     {
         InstanceId = _instanceId,
         WorkoutId  = 1,
         Timestamp  = new DateTime(2018, 1, 1, 12, 0, 0)
     });
     _scorecardService.Save(new ExerciseScored
     {
         ExerciseId = 1,
         InstanceId = _instanceId,
         Score      = 4,
         Timestamp  = new DateTime(2018, 1, 1, 12, 1, 0)
     });
     _scorecardService.Save(new WorkoutCompleted
     {
         InstanceId = _instanceId,
         Timestamp  = new DateTime(2018, 1, 1, 12, 2, 0)
     });
 }
Пример #2
0
        public static void Handle(WorkoutEvent @event)
        {
            switch (@event)
            {
            case WorkoutStarted e:
                WorkoutState.Save(e);
                Scorecard.Save(e);
                break;

            case ExerciseScored e:
                WorkoutState.Save(e);
                Scorecard.Save(e);
                TopScores.Save(e);
                break;

            case WorkoutCompleted e:
                WorkoutState.Save(e);
                Scorecard.Save(e);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }