Exemple #1
0
        private static Invitation SeedMdpInvitation(IPOContext dbContext, string plant)
        {
            var commPkg = new CommPkg(plant, KnownTestData.ProjectName, KnownTestData.CommPkgNo, "Description", "OK",
                                      "1|2");
            var invitationRepository = new InvitationRepository(dbContext);
            var seedMdpInvitation    = new Invitation(
                plant,
                KnownTestData.ProjectName,
                $"{KnownTestData.InvitationTitle} MDP",
                KnownTestData.InvitationDescription,
                DisciplineType.MDP,
                new DateTime(2020, 9, 1, 10, 0, 0, DateTimeKind.Utc),
                new DateTime(2020, 9, 1, 11, 0, 0, DateTimeKind.Utc),
                null,
                null,
                new List <CommPkg> {
                commPkg
            })
            {
                MeetingId = KnownTestData.MeetingId
            };

            invitationRepository.Add(seedMdpInvitation);
            dbContext.SaveChangesAsync().Wait();

            return(seedMdpInvitation);
        }
Exemple #2
0
 public void Setup() => _dut = new CommPkg(TestPlant, ProjectName, CommPkgNo, Description, Status, System);
        public void Setup()
        {
            _mcPkg = new McPkg(TestPlant, _projectName2, _commPkgNo2, _mcPkgNo, "Description", _system);
            _mcPkg.SetProtectedIdForTesting(McPkgId);

            _commPkg = new CommPkg(TestPlant, _projectName, _commPkgNo, "Description", "OK", "1|2");
            _commPkg.SetProtectedIdForTesting(CommPkgId);

            _commPkg2 = new CommPkg(TestPlant, _projectName, _commPkgNo2, "Description", "OK", "1|2");
            _commPkg.SetProtectedIdForTesting(CommPkgId);

            _commPkg4 = new CommPkg(TestPlant, _projectName, _commPkgNo4, "Description", "OK", "1|2");
            _commPkg4.SetProtectedIdForTesting(CommPkgId4);

            _mcPkg2 = new McPkg(TestPlant, _projectName, _commPkgNo, _mcPkgNo2, "Description", _system);
            _mcPkg2.SetProtectedIdForTesting(McPkgId2);

            _mcPkg3 = new McPkg(TestPlant, _projectName, _commPkgNo3, _mcPkgNo3, "Description", _system);
            _mcPkg3.SetProtectedIdForTesting(McPkgId3);

            _participant = new Participant(
                TestPlant,
                Organization.Contractor,
                IpoParticipantType.FunctionalRole,
                "FR",
                null,
                null,
                null,
                "*****@*****.**",
                null,
                0);
            _participant.SetProtectedIdForTesting(ParticipantId);

            _dpInviation = new Invitation(
                TestPlant,
                _projectName2,
                "Title",
                "D",
                DisciplineType.DP,
                new DateTime(),
                new DateTime(),
                null,
                new List <McPkg> {
                _mcPkg
            },
                null);
            _dpInviation.SetProtectedIdForTesting(InvitationWithMcPkgId);
            _dpInviationMove = new Invitation(
                TestPlant,
                _projectName,
                "Title",
                "D",
                DisciplineType.DP,
                new DateTime(),
                new DateTime(),
                null,
                new List <McPkg> {
                _mcPkg3
            },
                null);
            _dpInviationMove.SetProtectedIdForTesting(InvitationWithMcPkgMoveId);
            _mdpInvitation = new Invitation(
                TestPlant,
                _projectName,
                "Title 2",
                "D",
                DisciplineType.MDP,
                new DateTime(),
                new DateTime(),
                null,
                null,
                new List <CommPkg> {
                _commPkg
            });
            _mdpInvitationWithTwoCommpkgs = new Invitation(
                TestPlant,
                _projectName,
                "Title 3",
                "D",
                DisciplineType.MDP,
                new DateTime(),
                new DateTime(),
                null,
                null,
                new List <CommPkg> {
                _commPkg, _commPkg2
            });

            _attachment = new Attachment(TestPlant, "filename.txt");

            _dpInviation.AddParticipant(_participant);
            _dpInviation.AddAttachment(_attachment);

            _comment = new Comment(TestPlant, "comment");
            _mdpInvitation.AddComment(_comment);

            _mdpInvitation4 = new Invitation(
                TestPlant,
                _projectName,
                "Title 4",
                "D",
                DisciplineType.MDP,
                new DateTime(),
                new DateTime(),
                null,
                null,
                new List <CommPkg> {
                _commPkg4
            });

            _invitations = new List <Invitation>
            {
                _dpInviation,
                _dpInviationMove,
                _mdpInvitation,
                _mdpInvitationWithTwoCommpkgs,
                _mdpInvitation4
            };

            _dbInvitationSetMock = _invitations.AsQueryable().BuildMockDbSet();

            ContextHelper
            .ContextMock
            .Setup(x => x.Invitations)
            .Returns(_dbInvitationSetMock.Object);

            var attachments = new List <Attachment>
            {
                _attachment
            };

            _attachmentSetMock = attachments.AsQueryable().BuildMockDbSet();

            ContextHelper
            .ContextMock
            .Setup(x => x.Attachments)
            .Returns(_attachmentSetMock.Object);

            var participants = new List <Participant>
            {
                _participant
            };

            _participantSetMock = participants.AsQueryable().BuildMockDbSet();

            ContextHelper
            .ContextMock
            .Setup(x => x.Participants)
            .Returns(_participantSetMock.Object);

            var mcPkgs = new List <McPkg>
            {
                _mcPkg,
                _mcPkg2,
                _mcPkg3
            };

            _mcPkgSetMock = mcPkgs.AsQueryable().BuildMockDbSet();

            ContextHelper
            .ContextMock
            .Setup(x => x.McPkgs)
            .Returns(_mcPkgSetMock.Object);

            var commPkgs = new List <CommPkg>
            {
                _commPkg,
                _commPkg2,
                _commPkg4
            };

            _commPkgSetMock = commPkgs.AsQueryable().BuildMockDbSet();

            ContextHelper
            .ContextMock
            .Setup(x => x.CommPkgs)
            .Returns(_commPkgSetMock.Object);

            var comments = new List <Comment>
            {
                _comment
            };

            _commentSetMock = comments.AsQueryable().BuildMockDbSet();

            ContextHelper
            .ContextMock
            .Setup(x => x.Comments)
            .Returns(_commentSetMock.Object);

            _dut = new InvitationRepository(ContextHelper.ContextMock.Object);
        }
        protected override void SetupNewDatabase(DbContextOptions <IPOContext> dbContextOptions)
        {
            using (var context = new IPOContext(dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var          meetingId      = new Guid("11111111-2222-2222-2222-333333333333");
                var          personAzureOid = new Guid("44444444-5555-5555-5555-666666666666");
                const string description    = "Description";

                var functionalRoleParticipant = new Participant(
                    TestPlant,
                    Organization.Contractor,
                    IpoParticipantType.FunctionalRole,
                    "FR1",
                    null,
                    null,
                    null,
                    "*****@*****.**",
                    null,
                    0);

                var personParticipant = new Participant(
                    TestPlant,
                    Organization.ConstructionCompany,
                    IpoParticipantType.Person,
                    null,
                    "FirstName",
                    "LastName",
                    "UN",
                    "*****@*****.**",
                    personAzureOid,
                    1);

                var functionalRoleParticipant2 = new Participant(
                    TestPlant,
                    Organization.Contractor,
                    IpoParticipantType.FunctionalRole,
                    "FR2",
                    null,
                    null,
                    null,
                    "*****@*****.**",
                    null,
                    0);

                var personParticipant2 = new Participant(
                    TestPlant,
                    Organization.ConstructionCompany,
                    IpoParticipantType.Person,
                    null,
                    "FirstName2",
                    "LastName",
                    "UN",
                    "*****@*****.**",
                    personAzureOid,
                    1);

                var commPkg = new CommPkg(
                    TestPlant,
                    _projectName,
                    _commPkgNo,
                    description,
                    "OK",
                    "1|2");

                var mcPkg1 = new McPkg(
                    TestPlant,
                    _projectName,
                    _commPkgNo,
                    "McPkgNo1",
                    description,
                    _system);

                var mcPkg2 = new McPkg(
                    TestPlant,
                    _projectName,
                    _commPkgNo,
                    "McPkgNo2",
                    description,
                    _system);

                _dpInvitation = new Invitation(
                    TestPlant,
                    _projectName,
                    "DP Title",
                    "Description1",
                    DisciplineType.DP,
                    new DateTime(),
                    new DateTime(),
                    null,
                    new List <McPkg> {
                    mcPkg1, mcPkg2
                },
                    null)
                {
                    MeetingId = meetingId
                };

                _dpInvitation.AddParticipant(functionalRoleParticipant);
                _dpInvitation.AddParticipant(personParticipant);

                _mdpInvitation = new Invitation(
                    TestPlant,
                    _projectName,
                    "MDP Title",
                    "Description2",
                    DisciplineType.MDP,
                    new DateTime(),
                    new DateTime(),
                    null,
                    null,
                    new List <CommPkg> {
                    commPkg
                })
                {
                    MeetingId = meetingId
                };

                _mdpInvitation.AddParticipant(functionalRoleParticipant2);
                _mdpInvitation.AddParticipant(personParticipant2);

                context.Invitations.Add(_dpInvitation);
                context.Invitations.Add(_mdpInvitation);
                context.SaveChangesAsync().Wait();
                _dpInvitationId  = _dpInvitation.Id;
                _mdpInvitationId = _mdpInvitation.Id;
            }
        }
        protected override void SetupNewDatabase(DbContextOptions <IPOContext> dbContextOptions)
        {
            using (var context = new IPOContext(dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var meetingId = new Guid("11111111-2222-2222-2222-333333333333");

                var commPkg1 = new CommPkg(
                    TestPlant,
                    _projectName,
                    _commPkgNo1,
                    "Description",
                    "OK",
                    _system);

                var commPkg2 = new CommPkg(
                    TestPlant,
                    _projectName,
                    _commPkgNo2,
                    "Description",
                    "OK",
                    _system);

                _mdpInvitation = new Invitation(
                    TestPlant,
                    _projectName,
                    "MDP with mc pkgs",
                    "Description1",
                    DisciplineType.MDP,
                    new DateTime(),
                    new DateTime(),
                    null,
                    null,
                    new List <CommPkg> {
                    commPkg1, commPkg2
                })
                {
                    MeetingId = meetingId
                };

                _mdpInvitation1 = new Invitation(
                    TestPlant,
                    _projectName,
                    "MDP Title",
                    "Description2",
                    DisciplineType.MDP,
                    new DateTime(),
                    new DateTime(),
                    null,
                    null,
                    new List <CommPkg> {
                    commPkg1
                })
                {
                    MeetingId = meetingId
                };

                _mdpInvitation2 = new Invitation(
                    TestPlant,
                    _projectName,
                    "MDP Title 2",
                    "Description3",
                    DisciplineType.MDP,
                    new DateTime(),
                    new DateTime(),
                    null,
                    null,
                    new List <CommPkg> {
                    commPkg2
                })
                {
                    MeetingId = meetingId
                };

                context.Invitations.Add(_mdpInvitation);
                context.SaveChangesAsync().Wait();

                var timeProvider = new ManualTimeProvider(new DateTime(2020, 2, 2, 0, 0, 0, DateTimeKind.Utc));
                TimeService.SetProvider(timeProvider);

                context.Invitations.Add(_mdpInvitation1);
                context.Invitations.Add(_mdpInvitation2);
                context.SaveChangesAsync().Wait();
                _mdpInvitationId1 = _mdpInvitation1.Id;
                _mdpInvitationId2 = _mdpInvitation2.Id;
            }
        }
Exemple #6
0
        protected override void SetupNewDatabase(DbContextOptions <IPOContext> dbContextOptions)
        {
            using (var context = new IPOContext(dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                const string description = "Description";

                var contractorFunctionalRoleParticipant = new Participant(
                    TestPlant,
                    Organization.Contractor,
                    IpoParticipantType.FunctionalRole,
                    _functionalRoleCode1,
                    null,
                    null,
                    null,
                    _frEmail1,
                    null,
                    0);

                var constructionCompanyFunctionalRoleParticipant = new Participant(
                    TestPlant,
                    Organization.ConstructionCompany,
                    IpoParticipantType.FunctionalRole,
                    _functionalRoleCode2,
                    null,
                    null,
                    null,
                    null,
                    null,
                    1);

                var commissioningFunctionalRoleParticipant = new Participant(
                    TestPlant,
                    Organization.Commissioning,
                    IpoParticipantType.FunctionalRole,
                    _functionalRoleCode3,
                    null,
                    null,
                    null,
                    null,
                    null,
                    2);

                var contractorPersonParticipant = new Participant(
                    TestPlant,
                    Organization.Contractor,
                    IpoParticipantType.Person,
                    null,
                    "FirstName",
                    "LastName",
                    "UN",
                    _personEmail1,
                    _currentUserOid,
                    0);

                var constructionCompanyPersonParticipant = new Participant(
                    TestPlant,
                    Organization.ConstructionCompany,
                    IpoParticipantType.Person,
                    null,
                    "FirstName2",
                    "LastName2",
                    "UN",
                    _personEmail2,
                    _personGuid,
                    1);

                var contractorPersonParticipant1 = new Participant(
                    TestPlant,
                    Organization.Contractor,
                    IpoParticipantType.Person,
                    null,
                    "FirstName1",
                    "LastName1",
                    "UN",
                    _personEmail1,
                    _currentUserOid,
                    0);

                var constructionCompanyPersonParticipant1 = new Participant(
                    TestPlant,
                    Organization.ConstructionCompany,
                    IpoParticipantType.Person,
                    null,
                    "FirstName",
                    "LastName",
                    "UN",
                    _personEmail2,
                    _personGuid,
                    1);

                var commissioningPersonParticipant = new Participant(
                    TestPlant,
                    Organization.Commissioning,
                    IpoParticipantType.Person,
                    null,
                    "FirstName3",
                    "LastName3",
                    "UN",
                    _personEmail3,
                    _personGuid,
                    7);

                var externalPersonParticipant = new Participant(
                    TestPlant,
                    Organization.External,
                    IpoParticipantType.Person,
                    null,
                    null,
                    null,
                    null,
                    _externalPersonEmail,
                    _personGuid,
                    8);

                var contractorFunctionalRolePersonParticipant = new Participant(
                    TestPlant,
                    Organization.Contractor,
                    IpoParticipantType.Person,
                    _functionalRoleCode1,
                    "FirstName2",
                    "LastName2",
                    "UN2",
                    _frPersonEmail1,
                    _frPersonGuid1,
                    0);

                var constructionCompanyFunctionalRolePersonParticipant = new Participant(
                    TestPlant,
                    Organization.ConstructionCompany,
                    IpoParticipantType.Person,
                    _functionalRoleCode2,
                    "FirstName3",
                    "LastName3",
                    "UN3",
                    _frPersonEmail2,
                    _frPersonGuid2,
                    10);

                var constructionCompanyFunctionalRolePersonParticipant1 = new Participant(
                    TestPlant,
                    Organization.ConstructionCompany,
                    IpoParticipantType.Person,
                    _functionalRoleCode3,
                    "FirstName4",
                    "LastName4",
                    "UN4",
                    _frPersonEmail3,
                    _frPersonGuid3,
                    11);

                var commPkg = new CommPkg(
                    TestPlant,
                    _projectName,
                    _commPkgNo,
                    description,
                    "OK",
                    "1|2");

                var mcPkg1 = new McPkg(
                    TestPlant,
                    _projectName,
                    _commPkgNo,
                    _mcPkgNo,
                    description,
                    _system);

                var mcPkg2 = new McPkg(
                    TestPlant,
                    _projectName,
                    _commPkgNo2,
                    _mcPkgNo,
                    description,
                    _system);

                var startTime1 = _timeProvider.UtcNow;

                _invitation1 = new Invitation(
                    TestPlant,
                    _projectName,
                    _title1,
                    "Description",
                    DisciplineType.DP,
                    startTime1,
                    startTime1.AddHours(1),
                    null,
                    new List <McPkg> {
                    mcPkg1
                },
                    null);

                _invitation1.AddParticipant(contractorFunctionalRoleParticipant);
                _invitation1.AddParticipant(constructionCompanyPersonParticipant);
                _invitation1.AddParticipant(contractorFunctionalRolePersonParticipant);
                _invitation1.AddParticipant(commissioningPersonParticipant);
                _invitation1.AddParticipant(commissioningFunctionalRoleParticipant);
                _invitation1.AddParticipant(constructionCompanyFunctionalRolePersonParticipant1);
                _invitation1.AddParticipant(externalPersonParticipant);

                var startTime2 = _timeProvider.UtcNow.AddWeeks(1);

                _invitation2 = new Invitation(
                    TestPlant,
                    _projectName2,
                    _title1,
                    "Description",
                    DisciplineType.MDP,
                    startTime2,
                    startTime2.AddHours(1),
                    null,
                    null,
                    new List <CommPkg> {
                    commPkg
                });

                _invitation2.AddParticipant(constructionCompanyFunctionalRoleParticipant);
                _invitation2.AddParticipant(contractorPersonParticipant);
                _invitation2.AddParticipant(constructionCompanyFunctionalRolePersonParticipant);

                var startTime3 = _timeProvider.UtcNow.AddWeeks(2);

                _invitation3 = new Invitation(
                    TestPlant,
                    _projectName2,
                    _title2,
                    "Description",
                    DisciplineType.DP,
                    startTime3,
                    startTime3.AddHours(1),
                    null,
                    new List <McPkg> {
                    mcPkg2
                },
                    null);

                _invitation3.AddParticipant(contractorPersonParticipant1);
                _invitation3.AddParticipant(constructionCompanyPersonParticipant1);

                context.Invitations.Add(_invitation1);
                context.Invitations.Add(_invitation2);
                context.Invitations.Add(_invitation3);
                context.SaveChangesAsync().Wait();
            }
        }
        protected override void SetupNewDatabase(DbContextOptions <IPOContext> dbContextOptions)
        {
            using (var context =
                       new IPOContext(dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                const string description = "Description";

                var functionalRoleParticipant1 = new Participant(
                    TestPlant,
                    Organization.Contractor,
                    IpoParticipantType.FunctionalRole,
                    _functionalRoleCode1,
                    null,
                    null,
                    null,
                    _frEmail1,
                    null,
                    0);

                var functionalRoleParticipant2 = new Participant(
                    TestPlant,
                    Organization.ConstructionCompany,
                    IpoParticipantType.FunctionalRole,
                    _functionalRoleCode2,
                    null,
                    null,
                    null,
                    null,
                    null,
                    1);

                var personParticipant1 = new Participant(
                    TestPlant,
                    Organization.Contractor,
                    IpoParticipantType.Person,
                    null,
                    "FirstName",
                    "LastName",
                    "UN",
                    _personEmail1,
                    _currentUserOid,
                    0);

                var personParticipant2 = new Participant(
                    TestPlant,
                    Organization.ConstructionCompany,
                    IpoParticipantType.Person,
                    null,
                    "FirstName2",
                    "LastName2",
                    "UN",
                    _personEmail2,
                    _personGuid,
                    1);

                var personParticipant3 = new Participant(
                    TestPlant,
                    Organization.Contractor,
                    IpoParticipantType.Person,
                    null,
                    "FirstName3",
                    "LastName3",
                    "UN",
                    _personEmail1,
                    _currentUserOid,
                    0);

                var personParticipant4 = new Participant(
                    TestPlant,
                    Organization.ConstructionCompany,
                    IpoParticipantType.Person,
                    null,
                    "FirstName",
                    "LastName",
                    "UN",
                    _personEmail2,
                    _personGuid,
                    1);

                var frPerson1 = new Participant(
                    TestPlant,
                    Organization.Contractor,
                    IpoParticipantType.Person,
                    _functionalRoleCode1,
                    "FirstName2",
                    "LastName2",
                    "UN2",
                    _frPersonEmail1,
                    _frPersonGuid1,
                    0);

                var frPerson2 = new Participant(
                    TestPlant,
                    Organization.ConstructionCompany,
                    IpoParticipantType.Person,
                    _functionalRoleCode2,
                    "FirstName3",
                    "LastName3",
                    "UN3",
                    _frPersonEmail2,
                    _frPersonGuid2,
                    1);

                var supplierPersonParticipant = new Participant(
                    TestPlant,
                    Organization.Supplier,
                    IpoParticipantType.Person,
                    null,
                    "SupplierFirstName",
                    "SupplierLastName",
                    "UN",
                    _personEmail3,
                    _personGuid,
                    5);

                var commPkg = new CommPkg(
                    TestPlant,
                    _projectName,
                    _commPkgNo,
                    description,
                    "OK",
                    "1|2");

                var mcPkg1 = new McPkg(
                    TestPlant,
                    _projectName,
                    _commPkgNo,
                    _mcPkgNo,
                    description,
                    _system);

                var mcPkg2 = new McPkg(
                    TestPlant,
                    _projectName,
                    _commPkgNo2,
                    _mcPkgNo,
                    description,
                    _system);

                var startTime1 = _timeProvider.UtcNow;

                _invitation1 = new Invitation(
                    TestPlant,
                    _projectName,
                    _title1,
                    "Description",
                    DisciplineType.DP,
                    startTime1,
                    startTime1.AddHours(1),
                    null,
                    new List <McPkg> {
                    mcPkg1
                },
                    null);

                _invitation1.AddParticipant(functionalRoleParticipant1);
                _invitation1.AddParticipant(personParticipant2);
                _invitation1.AddParticipant(frPerson1);
                _invitation1.AddParticipant(supplierPersonParticipant);

                var startTime2 = _timeProvider.UtcNow.AddWeeks(1);

                _invitation2 = new Invitation(
                    TestPlant,
                    _projectName2,
                    _title1,
                    "Description",
                    DisciplineType.MDP,
                    startTime2,
                    startTime2.AddHours(1),
                    null,
                    null,
                    new List <CommPkg> {
                    commPkg
                });

                personParticipant1.SetProtectedIdForTesting(_participantId1);
                _invitation2.AddParticipant(functionalRoleParticipant2);
                _invitation2.AddParticipant(personParticipant1);
                _invitation2.AddParticipant(frPerson2);

                _currentPerson = new Person(_currentUserOid, "firstname", "lastname", "testusername", null);
                _currentPerson.SetProtectedIdForTesting(_participantId1);

                _personRepositoryMock = new Mock <IPersonRepository>();
                _personRepositoryMock
                .Setup(x => x.GetByIdAsync(It.IsAny <int>()))
                .Returns(Task.FromResult(_currentPerson));

                var startTime3 = _timeProvider.UtcNow.AddWeeks(2);

                _invitation3 = new Invitation(
                    TestPlant,
                    _projectName2,
                    _title2,
                    "Description",
                    DisciplineType.DP,
                    startTime3,
                    startTime3.AddHours(1),
                    null,
                    new List <McPkg> {
                    mcPkg2
                },
                    null);

                _invitation3.AddParticipant(personParticipant3);
                _invitation3.AddParticipant(personParticipant4);

                context.Invitations.Add(_invitation1);
                var history1 = new History(TestPlant, "D1", _invitation1.ObjectGuid, EventType.IpoCreated);
                context.History.Add(history1);

                context.Invitations.Add(_invitation2);
                var history2 = new History(TestPlant, "D2", _invitation2.ObjectGuid, EventType.IpoCreated);
                context.History.Add(history2);

                context.Invitations.Add(_invitation3);
                var history3 = new History(TestPlant, "D3", _invitation3.ObjectGuid, EventType.IpoCreated);
                context.History.Add(history3);

                context.SaveChangesAsync().Wait();
            }
        }
        protected override void SetupNewDatabase(DbContextOptions <IPOContext> dbContextOptions)
        {
            using (var context = new IPOContext(dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                const string projectName = "Project1";
                const string description = "Description";
                const string commPkgNo   = "CommPkgNo";
                const string mcPkgNo     = "McPkgNo";
                const string system      = "1|2";

                var functionalRoleParticipant = new Participant(
                    TestPlant,
                    Organization.Contractor,
                    IpoParticipantType.FunctionalRole,
                    _functionalRoleCode1,
                    null,
                    null,
                    null,
                    _frEmail1,
                    null,
                    0);

                var personParticipant = new Participant(
                    TestPlant,
                    Organization.ConstructionCompany,
                    IpoParticipantType.Person,
                    null,
                    "FirstName",
                    "LastName",
                    "UN",
                    _personEmail1,
                    _currentUserOid,
                    1);

                var functionalRoleParticipant2 = new Participant(
                    TestPlant,
                    Organization.Commissioning,
                    IpoParticipantType.FunctionalRole,
                    _functionalRoleCode2,
                    null,
                    null,
                    null,
                    null,
                    null,
                    2);

                var frPerson1 = new Participant(
                    TestPlant,
                    Organization.Commissioning,
                    IpoParticipantType.Person,
                    _functionalRoleCode2,
                    "FirstName2",
                    "LastName2",
                    "UN2",
                    _frPersonEmail1,
                    new Guid("11111111-2222-2222-2222-333333333332"),
                    2);

                var frPerson2 = new Participant(
                    TestPlant,
                    Organization.Commissioning,
                    IpoParticipantType.Person,
                    _functionalRoleCode2,
                    "FirstName3",
                    "LastName3",
                    "UN3",
                    _frPersonEmail2,
                    new Guid("11111111-2222-2222-2222-333333333331"),
                    2);

                var commPkg = new CommPkg(
                    TestPlant,
                    projectName,
                    commPkgNo,
                    description,
                    "OK",
                    system);

                _mdpInvitation = new Invitation(
                    TestPlant,
                    projectName,
                    "Title",
                    "Description",
                    DisciplineType.MDP,
                    new DateTime(),
                    new DateTime(),
                    null,
                    null,
                    new List <CommPkg> {
                    commPkg
                })
                {
                    MeetingId = _meetingId
                };

                _mdpInvitation.AddParticipant(functionalRoleParticipant);
                _mdpInvitation.AddParticipant(personParticipant);
                _mdpInvitation.AddParticipant(functionalRoleParticipant2);
                _mdpInvitation.AddParticipant(frPerson1);
                _mdpInvitation.AddParticipant(frPerson2);

                var mcPkg = new McPkg(
                    TestPlant,
                    projectName,
                    commPkgNo,
                    mcPkgNo,
                    description,
                    system);

                _dpInvitation = new Invitation(
                    TestPlant,
                    projectName,
                    "Title 2",
                    "Description 2",
                    DisciplineType.DP,
                    new DateTime(),
                    new DateTime(),
                    null,
                    new List <McPkg> {
                    mcPkg
                },
                    null)
                {
                    MeetingId = _meetingId
                };

                var functionalRoleParticipantForDp = new Participant(
                    TestPlant,
                    Organization.Contractor,
                    IpoParticipantType.FunctionalRole,
                    _functionalRoleCode1,
                    null,
                    null,
                    null,
                    _frEmail1,
                    null,
                    0);

                var personParticipantForDp = new Participant(
                    TestPlant,
                    Organization.ConstructionCompany,
                    IpoParticipantType.Person,
                    null,
                    "FirstName",
                    "LastName",
                    "UN",
                    _personEmail1,
                    _currentUserOid,
                    1);

                _dpInvitation.AddParticipant(functionalRoleParticipantForDp);
                _dpInvitation.AddParticipant(personParticipantForDp);

                var functionalRoleDetails = new ProCoSysFunctionalRole
                {
                    Code             = _functionalRoleCode1,
                    Description      = "FR description",
                    Email            = _frEmail1,
                    InformationEmail = null,
                    Persons          = null,
                    UsePersonalEmail = false
                };

                var functionalRoleDetails2 = new ProCoSysFunctionalRole
                {
                    Code             = _functionalRoleCode2,
                    Description      = "FR description",
                    Email            = null,
                    InformationEmail = null,
                    Persons          = new List <ProCoSysPerson>
                    {
                        new ProCoSysPerson
                        {
                            AzureOid  = "11111111-2222-2222-2222-333333333332",
                            Email     = _frPersonEmail1,
                            FirstName = null,
                            LastName  = null,
                            UserName  = null
                        },
                        new ProCoSysPerson
                        {
                            AzureOid  = "11111111-2222-2222-2222-333333333331",
                            Email     = _frPersonEmail2,
                            FirstName = null,
                            LastName  = null,
                            UserName  = null
                        }
                    },
                    UsePersonalEmail = true
                };
                IList <ProCoSysFunctionalRole> frDetails = new List <ProCoSysFunctionalRole> {
                    functionalRoleDetails
                };
                IList <ProCoSysFunctionalRole> frDetails2 = new List <ProCoSysFunctionalRole> {
                    functionalRoleDetails2
                };

                _functionalRoleApiServiceMock = new Mock <IFunctionalRoleApiService>();
                _functionalRoleApiServiceMock
                .Setup(x => x.GetFunctionalRolesByCodeAsync(_plantProvider.Plant, new List <string> {
                    _functionalRoleCode1
                }))
                .Returns(Task.FromResult(frDetails));
                _functionalRoleApiServiceMock
                .Setup(x => x.GetFunctionalRolesByCodeAsync(_plantProvider.Plant, new List <string> {
                    _functionalRoleCode2
                }))
                .Returns(Task.FromResult(frDetails2));

                _loggerMock          = new Mock <ILogger <GetInvitationByIdQueryHandler> >();
                _permissionCacheMock = new Mock <IPermissionCache>();

                _meetingClientMock = new Mock <IFusionMeetingClient>();
                _meetingClientMock
                .Setup(x => x.GetMeetingAsync(It.IsAny <Guid>(), It.IsAny <Action <ODataQuery> >()))
                .Returns(Task.FromResult(
                             new GeneralMeeting(
                                 new ApiGeneralMeeting()
                {
                    Classification  = string.Empty,
                    Contract        = null,
                    Convention      = string.Empty,
                    DateCreatedUtc  = DateTime.MinValue,
                    DateEnd         = new ApiDateTimeTimeZoneModel(),
                    DateStart       = new ApiDateTimeTimeZoneModel(),
                    ExternalId      = null,
                    Id              = _meetingId,
                    InviteBodyHtml  = string.Empty,
                    IsDisabled      = false,
                    IsOnlineMeeting = false,
                    Location        = string.Empty,
                    Organizer       = new ApiPersonDetailsV1(),
                    OutlookMode     = string.Empty,
                    Participants    = new List <ApiMeetingParticipant>()
                    {
                        new ApiMeetingParticipant()
                        {
                            Id     = Guid.NewGuid(),
                            Person = new ApiPersonDetailsV1()
                            {
                                Id   = _currentUserOid,
                                Mail = _personEmail1
                            },
                            OutlookResponse = "None"
                        },
                        new ApiMeetingParticipant()
                        {
                            Id     = Guid.NewGuid(),
                            Person = new ApiPersonDetailsV1()
                            {
                                Id   = Guid.NewGuid(),
                                Mail = _frEmail1
                            },
                            OutlookResponse = "Declined"
                        },
                        new ApiMeetingParticipant()
                        {
                            Id     = Guid.NewGuid(),
                            Person = new ApiPersonDetailsV1()
                            {
                                Id   = Guid.NewGuid(),
                                Mail = _frPersonEmail1
                            },
                            OutlookResponse = "Accepted"
                        },
                        new ApiMeetingParticipant()
                        {
                            Id     = Guid.NewGuid(),
                            Person = new ApiPersonDetailsV1()
                            {
                                Id   = Guid.NewGuid(),
                                Mail = _frPersonEmail2
                            },
                            OutlookResponse = "Declined"
                        }
                    },
                    Project            = null,
                    ResponsiblePersons = new List <ApiPersonDetailsV1>(),
                    Series             = null,
                    Title = string.Empty
                })));


                context.Invitations.Add(_mdpInvitation);
                context.Invitations.Add(_dpInvitation);
                context.SaveChangesAsync().Wait();
                _mdpInvitationId = _mdpInvitation.Id;
                _dpInvitationId  = _dpInvitation.Id;
            }
        }