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); }
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); }
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); }