Esempio n. 1
0
        public void Should_Map()
        {
            // Arrange
            var dto = new SetMyProjectParticipationDto
            {
                Id        = Guid.NewGuid(),
                ProjectId = Guid.NewGuid(),
                Body      = new SetMyProjectParticipationBodyDto
                {
                    Comment  = "Comment",
                    StatusId = Guid.NewGuid()
                }
            };
            var expectedCommand = new SetProjectParticipation.Command
            {
                MusicianProfileId = dto.Id,
                ProjectId         = dto.ProjectId,
                Comment           = dto.Body.Comment,
                PersonId          = Guid.Empty,
                StatusId          = dto.Body.StatusId
            };

            // Act
            SetProjectParticipation.Command command = _mapper.Map <SetProjectParticipation.Command>(dto);

            // Assert
            command.Should().BeEquivalentTo(expectedCommand);
        }
Esempio n. 2
0
        public void Should_Map()
        {
            // Arrange

            ProjectParticipation projectParticipation = ProjectParticipationSeedData.StaffParticipation1;

            var command = new SetProjectParticipation.Command
            {
                CommentByStaffInner           = "CommantByStaffInner",
                CommentTeam                   = "CommentTeam",
                InvitationStatusId            = Guid.NewGuid(),
                MusicianProfileId             = Guid.NewGuid(),
                ParticipationStatusInnerId    = Guid.NewGuid(),
                ParticipationStatusInternalId = Guid.NewGuid(),
                ProjectId = Guid.NewGuid()
            };
            ProjectParticipation expectedParticipation = ProjectParticipationSeedData.StaffParticipation1;

            expectedParticipation.SetProperty(nameof(projectParticipation.CommentByStaffInner), command.CommentByStaffInner);
            expectedParticipation.SetProperty(nameof(projectParticipation.CommentTeam), command.CommentTeam);
            expectedParticipation.SetProperty(nameof(projectParticipation.ParticipationStatusInnerId), command.ParticipationStatusInnerId);
            expectedParticipation.SetProperty(nameof(projectParticipation.ParticipationStatusInternalId), command.ParticipationStatusInternalId);
            expectedParticipation.SetProperty(nameof(projectParticipation.InvitationStatusId), command.InvitationStatusId);

            // Act
            ProjectParticipation mappedParticipation = _mapper.Map(command, projectParticipation);

            // Assert
            mappedParticipation.Should().BeEquivalentTo(expectedParticipation);
        }
Esempio n. 3
0
        public void Should_Map()
        {
            // Arrange
            var dto = new SetProjectParticipationDto
            {
                Id   = Guid.NewGuid(),
                Body = new SetProjectParticipationBodyDto
                {
                    CommentByStaffInner           = "CommentByStaffInner",
                    CommentTeam                   = "CommentTeam",
                    InvitationStatusId            = Guid.NewGuid(),
                    MusicianProfileId             = Guid.NewGuid(),
                    ParticipationStatusInnerId    = Guid.NewGuid(),
                    ParticipationStatusInternalId = Guid.NewGuid()
                }
            };
            var expectedCommand = new SetProjectParticipation.Command
            {
                ProjectId                     = dto.Id,
                CommentByStaffInner           = dto.Body.CommentByStaffInner,
                CommentTeam                   = dto.Body.CommentTeam,
                InvitationStatusId            = dto.Body.InvitationStatusId,
                MusicianProfileId             = dto.Body.MusicianProfileId,
                ParticipationStatusInnerId    = dto.Body.ParticipationStatusInnerId,
                ParticipationStatusInternalId = dto.Body.ParticipationStatusInternalId
            };

            // Act
            SetProjectParticipation.Command command = _mapper.Map <SetProjectParticipation.Command>(dto);

            // Assert
            command.Should().BeEquivalentTo(expectedCommand);
        }
Esempio n. 4
0
        public async Task <ProjectParticipationDto> SetProjectParticipationAsync(SetProjectParticipationDto myProjectParticipationDto)
        {
            SetProjectParticipation.Command command = _mapper
                                                      .Map <SetProjectParticipation.Command>(myProjectParticipationDto);

            ProjectParticipation projectParticipation = await _mediator.Send(command);

            return(_mapper.Map <ProjectParticipationDto>(projectParticipation));
        }