Example #1
0
        public async Task <IEnumerable <ProjectParticipationDto> > GetParticipationsByIdAsync(Guid id)
        {
            var query = new GetForProject.Query {
                ProjectId = id
            };
            IOrderedQueryable <ProjectParticipation> projectParticipations = await _mediator.Send(query);

            return(await projectParticipations
                   .ProjectTo <ProjectParticipationDto>(_mapper.ConfigurationProvider)
                   .ToListAsync());
        }
Example #2
0
        public async Task Should_Get_ProjectParticipations()
        {
            // Arrange
            var query = new GetForProject.Query
            {
                ProjectId = ProjectSeedData.RockingXMas.Id
            };
            var expectedIds = new Guid[]
            {
                ProjectParticipationSeedData.AdminParticipation.Id,
                ProjectParticipationSeedData.PerformerRockingXMasParticipation.Id,
                ProjectParticipationSeedData.StaffParticipation1.Id,
                ProjectParticipationSeedData.StaffParticipation2.Id
            };

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

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