Esempio n. 1
0
        public async Task Should_Set_New_Project_Participation()
        {
            // Arrange
            MusicianProfile musicianProfile = MusicianProfileSeedData.PerformersHornMusicianProfile;
            Project         project         = ProjectSeedData.HoorayForHollywood;
            var             dto             = new SetProjectParticipationBodyDto
            {
                MusicianProfileId             = musicianProfile.Id,
                CommentByStaffInner           = "Staff comment",
                CommentTeam                   = "Team comment",
                InvitationStatusId            = SelectValueMappingSeedData.ProjectParticipationInvitationStatusMappings[0].Id,
                ParticipationStatusInnerId    = SelectValueMappingSeedData.ProjectParticipationStatusInnerMappings[0].Id,
                ParticipationStatusInternalId = SelectValueMappingSeedData.ProjectParticipationStatusInternalMappings[0].Id,
            };
            var expectedDto = new ProjectParticipationDto
            {
                ParticipationStatusInnerId    = dto.ParticipationStatusInnerId,
                ParticipationStatusInner      = "Interested",
                ParticipationStatusInternalId = dto.ParticipationStatusInternalId,
                ParticipationStatusInternal   = "Candidate",
                InvitationStatusId            = dto.InvitationStatusId,
                InvitationStatus    = "Invited",
                CreatedAt           = FakeDateTime.UtcNow,
                CreatedBy           = "Staff Member",
                CommentByStaffInner = "Staff comment",
                CommentTeam         = "Team comment",
                MusicianProfile     = new ReducedMusicianProfileDto
                {
                    Id             = musicianProfile.Id,
                    InstrumentName = "Horn",
                    Qualification  = "Student"
                },
                Project = ReducedProjectDtoData.HoorayForHollywood,
                Person  = ReducedPersonDtoData.Performer
            };

            // Act
            HttpResponseMessage responseMessage = await _authenticatedServer
                                                  .CreateClient()
                                                  .AuthenticateWith(_staff)
                                                  .PutAsync(ApiEndpoints.ProjectsController.SetParticipation(project.Id), BuildStringContent(dto));

            // Assert
            responseMessage.StatusCode.Should().Be(HttpStatusCode.OK);
            ProjectParticipationDto result = await DeserializeResponseMessageAsync <ProjectParticipationDto>(responseMessage);

            result.Should().BeEquivalentTo(expectedDto, opt => opt.Excluding(dto => dto.Id));
            result.Id.Should().NotBeEmpty();
        }
Esempio n. 2
0
        public async Task Should_Set_Existing_Project_Participation()
        {
            // Arrange
            MusicianProfile musicianProfile = MusicianProfileSeedData.PerformerMusicianProfile;
            Project         project         = ProjectSeedData.Schneekönigin;

            var dto = new SetProjectParticipationBodyDto
            {
                MusicianProfileId             = musicianProfile.Id,
                CommentByStaffInner           = "Staff comment",
                CommentTeam                   = "Team comment",
                InvitationStatusId            = SelectValueMappingSeedData.ProjectParticipationInvitationStatusMappings[1].Id,
                ParticipationStatusInnerId    = SelectValueMappingSeedData.ProjectParticipationStatusInnerMappings[0].Id,
                ParticipationStatusInternalId = SelectValueMappingSeedData.ProjectParticipationStatusInternalMappings[1].Id,
            };
            ProjectParticipationDto expectedDto = ProjectParticipationDtoData.PerformerSchneeköniginParticipationForStaff;

            expectedDto.CommentByStaffInner           = dto.CommentByStaffInner;
            expectedDto.CommentTeam                   = dto.CommentTeam;
            expectedDto.InvitationStatusId            = dto.InvitationStatusId;
            expectedDto.InvitationStatus              = "Not invited";
            expectedDto.ParticipationStatusInnerId    = dto.ParticipationStatusInnerId;
            expectedDto.ParticipationStatusInner      = "Interested";
            expectedDto.ParticipationStatusInternalId = dto.ParticipationStatusInternalId;
            expectedDto.ParticipationStatusInternal   = "Acceptance";
            expectedDto.ModifiedAt = FakeDateTime.UtcNow;
            expectedDto.ModifiedBy = "Staff Member";

            // Act
            HttpResponseMessage responseMessage = await _authenticatedServer
                                                  .CreateClient()
                                                  .AuthenticateWith(_staff)
                                                  .PutAsync(ApiEndpoints.ProjectsController.SetParticipation(project.Id), BuildStringContent(dto));

            // Assert
            responseMessage.StatusCode.Should().Be(HttpStatusCode.OK);
            ProjectParticipationDto result = await DeserializeResponseMessageAsync <ProjectParticipationDto>(responseMessage);

            result.Should().BeEquivalentTo(expectedDto);
        }