public async void UpdateApplicationShouldCreateNewApplicationWithUpdatedVersion()
        {
            var result = await _fixture.GetHttpResult(UrlPath + _applicationToUpdateId);

            var applicationToUpdate = JsonConvert.DeserializeObject <ApplicationDetailDto>(result.Content.ReadAsStringAsync().Result);

            var newCreateDto = new ApplicationCreateDto()
            {
                ConferenceId = applicationToUpdate.Conference?.Id,
                FilledForm   = "{\"1\":\"Messi\",\"2\":\"Rolando\"}",
                FormId       = applicationToUpdate.Form.Id,
                StatusId     = applicationToUpdate.StatusId,
                UserId       = applicationToUpdate.User.Id
            };

            var serializedApplication = JsonConvert.SerializeObject(newCreateDto);
            var response = await _fixture.PutHttpResult($"{UrlPath}{_applicationToUpdateId}", serializedApplication);

            response.Should().NotBeNull();
            response.StatusCode.Should().Be(HttpStatusCode.OK);

            var deserializedResponse = JsonConvert.DeserializeObject <ApplicationDetailDto>(response.Content.ReadAsStringAsync().Result);

            deserializedResponse.Version.Should().Be(applicationToUpdate.Version + 1);

            deserializedResponse.PreviousVersion.Should().Be(applicationToUpdate.Id);

            deserializedResponse.Comments.Count().Should().Be(applicationToUpdate.Comments.Count());

            deserializedResponse.Assignments.Count().Should().Be(applicationToUpdate.Assignments.Count());
            deserializedResponse.Assignments.Select(userDto => userDto.Id).ToList().ForEach(guid =>
            {
                applicationToUpdate.Assignments.Select(userDto => userDto.Id).Contains(guid).Should().Be(true);
            });
        }
Beispiel #2
0
        public async void ActivateFormShouldReturnOkAndSetFormToActive()
        {
            var result = await _fixture.PutHttpResult($"{UrlPath}{_inactiveForm}/activate", "");

            result.Should().NotBeNull();
            result.StatusCode.Should().Be(HttpStatusCode.OK);

            var activatedForm = await _fixture.GetHttpResult(UrlPath + _inactiveForm);

            var deserializedForm = JsonConvert.DeserializeObject <FormDetailDto>(activatedForm.Content.ReadAsStringAsync().Result);

            deserializedForm.IsActive.Should().Be(true);
        }
Beispiel #3
0
        public async void UpdateRoleShouldReturnOkAndUpdatedRoleDto()
        {
            var roleDto = new RoleDto()
            {
                Name = "Updated Test role"
            };

            var serializedRoleDto = JsonConvert.SerializeObject(roleDto);

            var result = await _fixture.PutHttpResult(UrlPath + _roleId2, serializedRoleDto);

            result.Should().NotBeNull();
            result.StatusCode.Should().Be(HttpStatusCode.OK);

            var deserializedResult = JsonConvert.DeserializeObject <RoleDto>(result.Content.ReadAsStringAsync().Result);

            deserializedResult.Name.Should().Be(roleDto.Name);
        }
        public async void UpdateConferenceByIdShouldReturnTheUpdatedConference()
        {
            var updatedConference = new ConferenceCreateDto()
            {
                DateOfEvent        = DateTime.UtcNow,
                Description        = "Updated Conference",
                NumberOfConference = 42,
                StartOfEvent       = "08:00",
                EndOfEvent         = "23:00",
                RoomOfEvent        = "L 3.03"
            };

            var serializedConference = JsonConvert.SerializeObject(updatedConference);
            var httpResponse         = await _fixture.PutHttpResult(UrlPath + _conferenceId3, serializedConference);

            httpResponse.Should().NotBeNull();
            httpResponse.StatusCode.Should().Be(HttpStatusCode.OK);

            var deserializeObject = JsonConvert.DeserializeObject <ConferenceDetailDto>(httpResponse.Content.ReadAsStringAsync().Result);

            deserializeObject.Should().BeOfType <ConferenceDetailDto>();
        }