internal async Task <(int, UnCompletePunchOutDto)> CreateValidUnCompletePunchOutDtoAsync(List <CreateParticipantsDto> participants) { var(invitationToCompleteAndUnCompleteId, completePunchOutDto) = await CreateValidCompletePunchOutDtoAsync(participants); await InvitationsControllerTestsHelper.CompletePunchOutAsync( UserType.Signer, TestFactory.PlantWithAccess, invitationToCompleteAndUnCompleteId, completePunchOutDto); var completedInvitation = await InvitationsControllerTestsHelper.GetInvitationAsync( UserType.Signer, TestFactory.PlantWithAccess, invitationToCompleteAndUnCompleteId); var completerParticipant = completedInvitation.Participants .Single(p => p.Organization == Organization.Contractor); var unCompletePunchOutDto = new UnCompletePunchOutDto { InvitationRowVersion = completedInvitation.RowVersion, ParticipantRowVersion = completerParticipant.RowVersion, }; return(invitationToCompleteAndUnCompleteId, unCompletePunchOutDto); }
public static async Task <string> UnCompletePunchOutAsync( UserType userType, string plant, int id, UnCompletePunchOutDto dto, HttpStatusCode expectedStatusCode = HttpStatusCode.OK, string expectedMessageOnBadRequest = null) { var bodyPayload = new { dto.InvitationRowVersion, dto.ParticipantRowVersion }; var serializePayload = JsonConvert.SerializeObject(bodyPayload); var content = new StringContent(serializePayload, Encoding.UTF8, "application/json"); var response = await TestFactory.Instance.GetHttpClient(userType, plant) .PutAsync($"{Route}/{id}/UnComplete", content); await TestsHelper.AssertResponseAsync(response, expectedStatusCode, expectedMessageOnBadRequest); if (expectedStatusCode != HttpStatusCode.OK) { return(null); } return(await response.Content.ReadAsStringAsync()); }