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); }
internal async Task <(int, ParticipantToChangeDto[])> CreateValidParticipantToChangeDtosAsync(List <CreateParticipantsDto> participants) { var(invitationToChangeId, completePunchOutDto) = await CreateValidCompletePunchOutDtoAsync(participants); await InvitationsControllerTestsHelper.CompletePunchOutAsync( UserType.Signer, TestFactory.PlantWithAccess, invitationToChangeId, completePunchOutDto); var completedInvitation = await InvitationsControllerTestsHelper.GetInvitationAsync( UserType.Signer, TestFactory.PlantWithAccess, invitationToChangeId); var completerParticipant = completedInvitation.Participants .Single(p => p.Organization == Organization.Contractor); var participantToChangeDtos = new[] { new ParticipantToChangeDto { Id = completerParticipant.Id, Attended = false, Note = $"Some note about the punch round or attendee {Guid.NewGuid():B}", RowVersion = completerParticipant.RowVersion } }; return(invitationToChangeId, participantToChangeDtos); }
internal async Task <(int, AcceptPunchOutDto)> CreateValidAcceptPunchOutDtoAsync(List <CreateParticipantsDto> participants) { var(invitationToCompleteAndAcceptId, completePunchOutDto) = await CreateValidCompletePunchOutDtoAsync(participants); await InvitationsControllerTestsHelper.CompletePunchOutAsync( UserType.Signer, TestFactory.PlantWithAccess, invitationToCompleteAndAcceptId, completePunchOutDto); var completedInvitation = await InvitationsControllerTestsHelper.GetInvitationAsync( UserType.Signer, TestFactory.PlantWithAccess, invitationToCompleteAndAcceptId); var accepterParticipant = completedInvitation.Participants .Single(p => p.Organization == Organization.ConstructionCompany); var acceptPunchOutDto = new AcceptPunchOutDto { InvitationRowVersion = completedInvitation.RowVersion, ParticipantRowVersion = accepterParticipant.RowVersion, Participants = new List <ParticipantToUpdateNoteDto> { new ParticipantToUpdateNoteDto { Id = accepterParticipant.Id, Note = $"Some note about the punch round or attendee {Guid.NewGuid():B}", RowVersion = accepterParticipant.RowVersion } } }; return(invitationToCompleteAndAcceptId, acceptPunchOutDto); }
public async Task CompletePunchOut_AsSigner_ShouldCompletePunchOut() { // Arrange var(invitationToCompleteId, completePunchOutDto) = await CreateValidCompletePunchOutDtoAsync(_participantsForSigning); // Act var newRowVersion = await InvitationsControllerTestsHelper.CompletePunchOutAsync( UserType.Signer, TestFactory.PlantWithAccess, invitationToCompleteId, completePunchOutDto); // Assert var completedInvitation = await InvitationsControllerTestsHelper.GetInvitationAsync( UserType.Signer, TestFactory.PlantWithAccess, invitationToCompleteId); var completingParticipant = completedInvitation.Participants.Single(p => p.Id == completePunchOutDto.Participants.Single().Id); Assert.AreEqual(IpoStatus.Completed, completedInvitation.Status); Assert.IsNotNull(completingParticipant.SignedAtUtc); Assert.AreEqual(_sigurdSigner.Oid, completingParticipant.SignedBy.AzureOid.ToString()); AssertRowVersionChange(completePunchOutDto.InvitationRowVersion, newRowVersion); }