Ejemplo n.º 1
0
        public async Task Should_Remove_Project()
        {
            // Arrange
            AppointmentDto expectedDto = AppointmentDtoData.StaffMeeting;

            expectedDto.Projects.Clear();
            AppointmentParticipationListItemDto performerParticipation = AppointmentDtoData.PerformerParticipation;

            performerParticipation.MusicianProfiles.Add(new ReducedMusicianProfileDto
            {
                Id             = Guid.Parse("e2ef2e6c-035e-4fff-9293-a6a7b67524a9"),
                InstrumentName = "Horn",
                Qualification  = "Student"
            });
            performerParticipation.MusicianProfiles.Add(new ReducedMusicianProfileDto
            {
                Id             = Guid.Parse("056a27f0-cd88-4cd9-8729-ce2f23b8b0ef"),
                InstrumentName = "Tuba"
            });
            performerParticipation.Participation = null;
            expectedDto.Participations.Add(performerParticipation);
            AppointmentParticipationListItemDto staffParticipation = AppointmentDtoData.StaffParticipation;

            staffParticipation.Participation = null;
            expectedDto.Participations.Add(staffParticipation);
            AppointmentParticipationListItemDto adminParticipation = AppointmentDtoData.AdminParticipation;

            expectedDto.Participations.Add(adminParticipation);
            adminParticipation.MusicianProfiles.Add(new ReducedMusicianProfileDto
            {
                Id             = Guid.Parse("9f6f3cab-6b0d-463e-8d66-58b9c760d498"),
                InstrumentName = "Soprano"
            });
            expectedDto.Participations.Add(AppointmentDtoData.WithoutRoleParticipation);

            // Act
            HttpResponseMessage responseMessage = await _authenticatedServer
                                                  .CreateClient()
                                                  .AuthenticateWith(_staff)
                                                  .DeleteAsync(ApiEndpoints.AppointmentsController.Project(
                                                                   AppointmentSeedData.StaffMeeting.Id,
                                                                   ProjectSeedData.HoorayForHollywood.Id));

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

            result.Should().BeEquivalentTo(expectedDto);
        }
Ejemplo n.º 2
0
        public async Task Should_Set_Dates()
        {
            // Arrange
            Appointment appointmentToModify = AppointmentSeedData.PhotoSession;
            var         setDatesDto         = new AppointmentSetDatesBodyDto
            {
                StartTime = FakeDateTime.UtcNow,
                EndTime   = FakeDateTime.UtcNow.AddHours(5)
            };
            AppointmentDto expectedDto = AppointmentDtoData.PhotoSession;

            expectedDto.EndTime    = setDatesDto.EndTime.Value;
            expectedDto.StartTime  = setDatesDto.StartTime.Value;
            expectedDto.ModifiedBy = _staff.DisplayName;
            expectedDto.ModifiedAt = FakeDateTime.UtcNow;
            AppointmentParticipationListItemDto performerParticipation = AppointmentDtoData.PerformerParticipation;

            performerParticipation.Participation = null;
            expectedDto.Participations.Add(performerParticipation);
            AppointmentParticipationListItemDto staffParticipation = AppointmentDtoData.StaffParticipation;

            staffParticipation.Participation = null;
            expectedDto.Participations.Add(staffParticipation);
            AppointmentParticipationListItemDto adminParticipation = AppointmentDtoData.AdminParticipation;

            adminParticipation.MusicianProfiles.Add(new ReducedMusicianProfileDto
            {
                Id             = Guid.Parse("9f6f3cab-6b0d-463e-8d66-58b9c760d498"),
                InstrumentName = SectionSeedData.Soprano.Name
            });
            expectedDto.Participations.Add(adminParticipation);
            expectedDto.Participations.Add(AppointmentDtoData.WithoutRoleParticipation);

            // Act
            HttpResponseMessage responseMessage = await _authenticatedServer
                                                  .CreateClient()
                                                  .AuthenticateWith(_staff)
                                                  .PutAsync(ApiEndpoints.AppointmentsController.SetDates(appointmentToModify.Id), BuildStringContent(setDatesDto));

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

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