Example #1
0
        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);
        }
Example #2
0
        public async Task AcceptPunchOut_AsSigner_ShouldAcceptPunchOut()
        {
            // Arrange
            var(invitationToAcceptId, acceptPunchOutDto) = await CreateValidAcceptPunchOutDtoAsync(_participantsForSigning);

            // Act
            var newRowVersion = await InvitationsControllerTestsHelper.AcceptPunchOutAsync(
                UserType.Signer,
                TestFactory.PlantWithAccess,
                invitationToAcceptId,
                acceptPunchOutDto);

            // Assert
            var acceptedInvitation = await InvitationsControllerTestsHelper.GetInvitationAsync(
                UserType.Signer,
                TestFactory.PlantWithAccess,
                invitationToAcceptId);

            var acceptingParticipant =
                acceptedInvitation.Participants.Single(p => p.Id == acceptPunchOutDto.Participants.Single().Id);

            Assert.AreEqual(IpoStatus.Accepted, acceptedInvitation.Status);
            Assert.IsNotNull(acceptingParticipant.SignedAtUtc);
            Assert.AreEqual(_sigurdSigner.Oid, acceptingParticipant.SignedBy.AzureOid.ToString());
            AssertRowVersionChange(acceptPunchOutDto.InvitationRowVersion, newRowVersion);
        }