internal async Task <(int, UnAcceptPunchOutDto)> CreateValidUnAcceptPunchOutDtoAsync(List <CreateParticipantsDto> participants) { var(invitationToAcceptId, acceptPunchOutDto) = await CreateValidAcceptPunchOutDtoAsync(participants); await InvitationsControllerTestsHelper.AcceptPunchOutAsync( UserType.Signer, TestFactory.PlantWithAccess, invitationToAcceptId, acceptPunchOutDto); var acceptedInvitation = await InvitationsControllerTestsHelper.GetInvitationAsync( UserType.Signer, TestFactory.PlantWithAccess, invitationToAcceptId); var accepterParticipant = acceptedInvitation.Participants .Single(p => p.Organization == Organization.ConstructionCompany); var unAcceptPunchOutDto = new UnAcceptPunchOutDto { InvitationRowVersion = acceptedInvitation.RowVersion, ParticipantRowVersion = accepterParticipant.RowVersion, }; return(invitationToAcceptId, unAcceptPunchOutDto); }
public static async Task <string> UnAcceptPunchOutAsync( UserType userType, string plant, int id, UnAcceptPunchOutDto 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}/UnAccept", content); await TestsHelper.AssertResponseAsync(response, expectedStatusCode, expectedMessageOnBadRequest); if (expectedStatusCode != HttpStatusCode.OK) { return(null); } return(await response.Content.ReadAsStringAsync()); }