Exemplo n.º 1
0
        public async Task <IEnumerable <ProjectParticipationDto> > GetProjectParticipationsAsync(Guid id, bool includeCompleted)
        {
            var query = new GetForMusicianProfile.Query {
                IncludeCompletedProjects = includeCompleted, MusicianProfileId = id
            };
            IEnumerable <ProjectParticipation> participations = await _mediator.Send(query);

            // Cannot use .ProjectTo here because .ProjectTo does not suppert After Mapping Actions
            return(_mapper.Map <IEnumerable <ProjectParticipationDto> >(participations));
        }
Exemplo n.º 2
0
        public async Task Should_Get_ProjectParticipations_Excluding_Completed_Projects()
        {
            // Arrange
            var query = new GetForMusicianProfile.Query
            {
                IncludeCompletedProjects = false,
                MusicianProfileId        = MusicianProfileSeedData.PerformerMusicianProfile.Id
            };

            // Act
            IEnumerable <ProjectParticipation> result = await _handler.Handle(query, new CancellationToken());

            // Assert
            result.Count().Should().Be(1);
            result.First().Id.Should().Be(ProjectParticipationSeedData.PerformerSchneeköniginParticipation.Id);
        }
Exemplo n.º 3
0
        public async Task Should_Get_ProjectParticipations_Including_Completed_Projects()
        {
            // Arrange
            var query = new GetForMusicianProfile.Query
            {
                IncludeCompletedProjects = true,
                MusicianProfileId        = MusicianProfileSeedData.PerformerMusicianProfile.Id
            };
            var expectedIds = new Guid[]
            {
                ProjectParticipationSeedData.PerformerRockingXMasParticipation.Id,
                ProjectParticipationSeedData.PerformerSchneeköniginParticipation.Id
            };

            // Act
            IEnumerable <ProjectParticipation> result = await _handler.Handle(query, new CancellationToken());

            // Assert
            result.Select(r => r.Id).Should().BeEquivalentTo(expectedIds, opt => opt.WithStrictOrdering());
        }