Exemple #1
0
        public async Task Should_Not_Modify_If_Not_Existing_Id_Is_Supplied()
        {
            // Arrange
            var modifyDto = new AppointmentModifyBodyDto
            {
                Name            = "New Appointment",
                InternalDetails = "Internal Details",
                PublicDetails   = "Public Details",
                EndTime         = FakeDateTime.UtcNow.AddHours(5),
                StartTime       = FakeDateTime.UtcNow,
            };

            // Act
            HttpResponseMessage responseMessage = await _authenticatedServer
                                                  .CreateClient()
                                                  .AuthenticateWith(_staff)
                                                  .PutAsync(ApiEndpoints.AppointmentsController.Put(Guid.NewGuid()), BuildStringContent(modifyDto));

            // Assert
            responseMessage.StatusCode.Should().Be(HttpStatusCode.NotFound);
            ValidationProblemDetails errorMessage = await DeserializeResponseMessageAsync <ValidationProblemDetails>(responseMessage);

            errorMessage.Title.Should().Be("Resource not found.");
            errorMessage.Status.Should().Be(404);
            errorMessage.Errors.Should().BeEquivalentTo(new Dictionary <string, string[]>()
            {
                { "Id", new[] { "Appointment could not be found." } }
            });
        }
Exemple #2
0
        public async Task Should_Modify()
        {
            // Arrange
            Appointment appointmentToModify = AppointmentSeedData.RockingXMasConcert;

            var modifyDto = new AppointmentModifyBodyDto
            {
                Name            = "New Appointment",
                InternalDetails = "Internal Details",
                PublicDetails   = "Public Details",
                CategoryId      = SelectValueMappingSeedData.AppointmentCategoryMappings[0].Id,
                SalaryId        = SelectValueMappingSeedData.AppointmentSalaryMappings[0].Id,
                SalaryPatternId = SelectValueMappingSeedData.AppointmentSalaryPatternMappings[0].Id,
                EndTime         = FakeDateTime.UtcNow.AddHours(5),
                StartTime       = FakeDateTime.UtcNow,
                StatusId        = SelectValueMappingSeedData.AppointmentStatusMappings[0].Id
            };

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

            // Assert
            responseMessage.StatusCode.Should().Be(HttpStatusCode.NoContent);
        }
Exemple #3
0
        public async Task Should_Modify_With_Only_Mandatory_Fields_Specified()
        {
            // Arrange
            Appointment appointmentToModify = AppointmentSeedData.RockingXMasConcert;

            var modifyDto = new AppointmentModifyBodyDto
            {
                Name            = "New Appointment",
                InternalDetails = "Internal Details",
                PublicDetails   = "Public Details",
                EndTime         = FakeDateTime.UtcNow.AddHours(5),
                StartTime       = FakeDateTime.UtcNow,
            };

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

            // Assert
            responseMessage.StatusCode.Should().Be(HttpStatusCode.NoContent);
        }