public async Task GetOutstandingIpos_AsHacker_ShouldReturnBadRequest_WhenUnknownPlant()
 => await MeControllerTestsHelper.GetOutstandingIposAsync(
     UserType.Hacker,
     TestFactory.UnknownPlant,
     null,
     HttpStatusCode.BadRequest,
     "is not a valid plant");
Beispiel #2
0
        public async Task GetOutstandingIpos_AsSigner_ShouldGetOutstandingIpos()
        {
            //Arrange
            var invitationId = await InvitationsControllerTestsHelper.CreateInvitationAsync(
                UserType.Planner,
                TestFactory.PlantWithAccess,
                "InvitationTitle",
                "InvitationDescription",
                InvitationLocation,
                DisciplineType.DP,
                _invitationStartTime,
                _invitationEndTime,
                _participants,
                _mcPkgScope,
                null);

            var invitation = await InvitationsControllerTestsHelper.GetInvitationAsync(
                UserType.Signer,
                TestFactory.PlantWithAccess,
                invitationId);

            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 out round or attendee",
                        RowVersion = completerParticipant.RowVersion,
                        Attended   = true
                    }
                }
            };

            await InvitationsControllerTestsHelper.CompletePunchOutAsync(
                UserType.Signer,
                TestFactory.PlantWithAccess,
                invitationId,
                completePunchOutDto);

            // Act
            var outstandingIpos = await MeControllerTestsHelper.GetOutstandingIposAsync(
                UserType.Signer,
                TestFactory.PlantWithAccess,
                TestFactory.ProjectWithAccess);

            // Assert
            var outstandingIpo = outstandingIpos.Items.Single(oi => oi.InvitationId == invitationId);

            Assert.IsNotNull(outstandingIpo);
            Assert.AreEqual(invitationId, outstandingIpo.InvitationId);
            Assert.AreEqual(invitation.Description, outstandingIpo.Description);
        }
 public async Task GetOutstandingIpos_AsHacker_ShouldReturnForbidden_WhenPermissionMissing()
 => await MeControllerTestsHelper.GetOutstandingIposAsync(
     UserType.Hacker,
     TestFactory.PlantWithAccess,
     null,
     HttpStatusCode.Forbidden);
 public async Task GetOutstandingIpos_AsAnonymous_ShouldReturnUnauthorized()
 => await MeControllerTestsHelper.GetOutstandingIposAsync(
     UserType.Anonymous,
     TestFactory.UnknownPlant,
     null,
     HttpStatusCode.Unauthorized);