public async Task Should_Set_Existing_Project_Participation() { // Arrange MusicianProfile musicianProfile = MusicianProfileSeedData.PerformerMusicianProfile; Project project = ProjectSeedData.Schneekönigin; var dto = new SetMyProjectParticipationBodyDto { Comment = "Comment", StatusId = SelectValueMappingSeedData.ProjectParticipationStatusInnerMappings[0].Id }; ProjectParticipationDto expectedDto = ProjectParticipationDtoData.PerformerSchneeköniginParticipationForPerformer; expectedDto.CommentByPerformerInner = dto.Comment; expectedDto.ParticipationStatusInnerId = dto.StatusId; expectedDto.ParticipationStatusInner = "Interested"; expectedDto.ModifiedAt = FakeDateTime.UtcNow; expectedDto.ModifiedBy = "Per Former"; // Act HttpResponseMessage responseMessage = await _authenticatedServer .CreateClient() .AuthenticateWith(_performer) .PutAsync(ApiEndpoints.MyMusicianProfilesController.SetProjectParticipation( musicianProfile.Id, project.Id), BuildStringContent(dto)); // Assert responseMessage.StatusCode.Should().Be(HttpStatusCode.OK); ProjectParticipationDto result = await DeserializeResponseMessageAsync <ProjectParticipationDto>(responseMessage); result.Should().BeEquivalentTo(expectedDto); }
public void Should_Map_For_Performer() { // Arrange ProjectParticipation projectParticipation = FakeProjectParticipations.PerformerSchneeköniginParticipation; _tokenAccessor.UserRoles.Returns(new List <string> { RoleNames.Performer }); var expectedDto = new ProjectParticipationDto { Id = projectParticipation.Id, CommentByPerformerInner = projectParticipation.CommentByPerformerInner, CommentByStaffInner = projectParticipation.CommentByStaffInner, CommentTeam = null, InvitationStatus = null, InvitationStatusId = null, ParticipationStatusInternal = "Candidate", ParticipationStatusInternalId = projectParticipation.ParticipationStatusInternalId, ParticipationStatusInner = "Acceptance", ParticipationStatusInnerId = projectParticipation.ParticipationStatusInnerId, MusicianProfile = ReducedMusicianProfileDtoData.PerformerProfile, Project = ReducedProjectDtoData.Schneekönigin, Person = null }; // Act ProjectParticipationDto dto = _mapper.Map <ProjectParticipationDto>(projectParticipation); // Assert dto.Should().BeEquivalentTo(expectedDto); }
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(); }
public async Task Should_Set_New_Project_Participation() { // Arrange MusicianProfile musicianProfile = MusicianProfileSeedData.PerformersHornMusicianProfile; Project project = ProjectSeedData.HoorayForHollywood; var dto = new SetMyProjectParticipationBodyDto { Comment = "Comment", StatusId = SelectValueMappingSeedData.ProjectParticipationStatusInnerMappings[0].Id }; var expectedDto = new ProjectParticipationDto { CommentByPerformerInner = dto.Comment, ParticipationStatusInnerId = dto.StatusId, ParticipationStatusInner = "Interested", CreatedAt = FakeDateTime.UtcNow, CreatedBy = "Per Former", MusicianProfile = new ReducedMusicianProfileDto { Id = musicianProfile.Id, InstrumentName = "Horn", Qualification = "Student" }, Project = new ReducedProjectDto { Id = project.Id, Description = project.Description, Code = project.Code, ShortTitle = project.ShortTitle, Title = project.Title } }; // Act HttpResponseMessage responseMessage = await _authenticatedServer .CreateClient() .AuthenticateWith(_performer) .PutAsync(ApiEndpoints.MyMusicianProfilesController.SetProjectParticipation( musicianProfile.Id, 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(); }
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); }