internal async Task <(int, CancelPunchOutDto)> CreateValidCancelPunchOutDtoAsync(List <CreateParticipantsDto> participants, UserType userType = UserType.Planner) { var id = await InvitationsControllerTestsHelper.CreateInvitationAsync( userType, TestFactory.PlantWithAccess, Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), InvitationLocation, DisciplineType.DP, _invitationStartTime, _invitationEndTime, participants, _mcPkgScope, null); var invitation = await InvitationsControllerTestsHelper.GetInvitationAsync( UserType.Viewer, TestFactory.PlantWithAccess, id); var cancelPunchOutDto = new CancelPunchOutDto { RowVersion = invitation.RowVersion }; return(id, cancelPunchOutDto); }
internal async Task <(int, CompletePunchOutDto)> CreateValidCompletePunchOutDtoAsync(List <CreateParticipantsDto> participants) { var id = await InvitationsControllerTestsHelper.CreateInvitationAsync( UserType.Planner, TestFactory.PlantWithAccess, Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), InvitationLocation, DisciplineType.DP, _invitationStartTime, _invitationEndTime, participants, _mcPkgScope, null); var invitation = await InvitationsControllerTestsHelper.GetInvitationAsync( UserType.Viewer, TestFactory.PlantWithAccess, id); var completerParticipant = invitation.Participants .Single(p => p.Organization == Organization.Contractor); var completePunchOutDto = new CompletePunchOutDto { InvitationRowVersion = invitation.RowVersion, ParticipantRowVersion = completerParticipant.RowVersion, Participants = new List <ParticipantToChangeDto> { new ParticipantToChangeDto { Id = completerParticipant.Id, Note = $"Some note about the punch round or attendee {Guid.NewGuid():B}", RowVersion = completerParticipant.RowVersion, Attended = true } } }; return(id, completePunchOutDto); }
internal async Task <(int, EditInvitedInvitationDto)> CreateValidEditInvitationDtoAsync(IList <CreateParticipantsDto> participants) { var id = await InvitationsControllerTestsHelper.CreateInvitationAsync( UserType.Planner, TestFactory.PlantWithAccess, Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), InvitationLocation, DisciplineType.DP, _invitationStartTime, _invitationEndTime, participants, _mcPkgScope, null); var invitation = await InvitationsControllerTestsHelper.GetInvitationAsync( UserType.Viewer, TestFactory.PlantWithAccess, id); var editInvitationDto = new EditInvitedInvitationDto { Title = invitation.Title, Description = invitation.Description, StartTime = invitation.StartTimeUtc, EndTime = invitation.EndTimeUtc, Location = invitation.Location, ProjectName = invitation.ProjectName, RowVersion = invitation.RowVersion, UpdatedParticipants = ConvertToParticipantDtoEdit(invitation.Participants), UpdatedCommPkgScope = null, UpdatedMcPkgScope = _mcPkgScope }; return(id, editInvitationDto); }
public async Task CreateInvitation_AsPlanner_ShouldCreateInvitation() { const string Title = "InvitationTitle"; const string Description = "InvitationDescription"; // Act var id = await InvitationsControllerTestsHelper.CreateInvitationAsync( UserType.Planner, TestFactory.PlantWithAccess, Title, Description, InvitationLocation, DisciplineType.DP, _invitationStartTime, _invitationEndTime, _participants, _mcPkgScope, null ); // Assert var invitation = await InvitationsControllerTestsHelper.GetInvitationAsync( UserType.Viewer, TestFactory.PlantWithAccess, id); Assert.IsTrue(id > 0); Assert.IsNotNull(invitation); Assert.AreEqual(Title, invitation.Title); Assert.AreEqual(Description, invitation.Description); Assert.AreEqual(InvitationLocation, invitation.Location); Assert.AreEqual(_mcPkgScope.Count, invitation.McPkgScope.Count()); var originalParticipants = _participants; AssertParticipants(invitation, originalParticipants); }