Exemplo n.º 1
0
        public async Task CancelPunchOut_AsContractor_ShouldCancelPunchOut()
        {
            // Arrange
            var(invitationToCancelId, cancelPunchOutDto) = await CreateValidCancelPunchOutDtoAsync(_participants);

            TestFactory.Instance
            .PersonApiServiceMock
            .Setup(x => x.GetPersonInFunctionalRoleAsync(
                       TestFactory.PlantWithAccess,
                       _contractor.AsProCoSysPerson().AzureOid,
                       "FRCA"))
            .Returns(Task.FromResult(_contractor.AsProCoSysPerson()));

            // Act
            var newRowVersion = await InvitationsControllerTestsHelper.CancelPunchOutAsync(
                UserType.Contractor,
                TestFactory.PlantWithAccess,
                invitationToCancelId,
                cancelPunchOutDto);

            // Assert
            var canceledInvitation = await InvitationsControllerTestsHelper.GetInvitationAsync(
                UserType.Contractor,
                TestFactory.PlantWithAccess,
                invitationToCancelId);

            Assert.AreEqual(IpoStatus.Canceled, canceledInvitation.Status);
            AssertRowVersionChange(cancelPunchOutDto.RowVersion, newRowVersion);
        }
Exemplo n.º 2
0
        internal async Task <(int, string)> CreateValidDeletePunchOutDtoAsync(List <CreateParticipantsDto> participants, UserType userType = UserType.Planner)
        {
            var(invitationId, cancelPunchOutDto) = await CreateValidCancelPunchOutDtoAsync(participants, userType);

            await InvitationsControllerTestsHelper.CancelPunchOutAsync(
                UserType.Admin,
                TestFactory.PlantWithAccess,
                invitationId,
                cancelPunchOutDto);

            var canceledInvitation = await InvitationsControllerTestsHelper.GetInvitationAsync(
                UserType.Admin,
                TestFactory.PlantWithAccess,
                invitationId);

            return(invitationId, canceledInvitation.RowVersion);
        }
Exemplo n.º 3
0
        public async Task CancelPunchOut_AsCreator_ShouldCancelPunchOut()
        {
            // Arrange
            var(invitationToCancelId, cancelPunchOutDto) = await CreateValidCancelPunchOutDtoAsync(_participantsForSigning, UserType.Creator);

            // Act
            var newRowVersion = await InvitationsControllerTestsHelper.CancelPunchOutAsync(
                UserType.Creator,
                TestFactory.PlantWithAccess,
                invitationToCancelId,
                cancelPunchOutDto);

            // Assert
            var canceledInvitation = await InvitationsControllerTestsHelper.GetInvitationAsync(
                UserType.Creator,
                TestFactory.PlantWithAccess,
                invitationToCancelId);

            Assert.AreEqual(IpoStatus.Canceled, canceledInvitation.Status);
            AssertRowVersionChange(cancelPunchOutDto.RowVersion, newRowVersion);
        }