예제 #1
0
        public async Task get_training_by_id()
        {
            var ATraining = new TrainingBuilder()
                            .withId(1)
                            .withName("ATraining")
                            .withDescription("ADescription")
                            .withDateTime(new DateTime(2020, 1, 1)).withCreatedBy("AnId").Build();

            TrainingRepositoryPort.GetTrainingByUser(ATraining.CreatedBy).Returns(new List <Training> {
                ATraining
            });

            var result = await GetTrainingById.Execute(1);

            result.Should().BeEquivalentTo(new List <TrainingResponse> {
                new TrainingResponse {
                    Name        = ATraining.Name,
                    Description = ATraining.Description,
                    Date        = ATraining.DateTime,
                    CreatedBy   = ATraining.CreatedBy
                }
            });
        }
예제 #2
0
        public async Task <List <TrainingResponse> > Execute(string userId)
        {
            var trainings = await TrainingRepository.GetTrainingByUser(userId);

            return(MapListToTrainingResponse(trainings));
        }