コード例 #1
0
        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);
        }
コード例 #2
0
        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();
        }