/// <summary>
        /// Returns a business layer UpdatedParticipantPerson instance.
        /// </summary>
        /// <param name="user">The user performing the update.</param>
        /// <param name="projectId">The id of the project.</param>
        /// <returns>The business layer update entity.</returns>
        public UpdatedParticipantPerson ToUpdatedParticipantPerson(User user, int projectId)
        {
            var model = new UpdatedParticipantPerson(
                updater: user,
                projectId: projectId,
                participantId: this.ParticipantId,
                hostInstitutionId: this.HostInstitutionId,
                homeInstitutionId: this.HomeInstitutionId,
                hostInstitutionAddressId: this.HostInstitutionAddressId,
                homeInstitutionAddressId: this.HomeInstitutionAddressId,
                participantTypeId: this.ParticipantTypeId,
                participantStatusId: this.ParticipantStatusId,
                placementOrganizationId: this.PlacementOrganizationId,
                placementOrganizationAddressId: this.PlacementOrganizationAddressId
                );

            return(model);
        }
Esempio n. 2
0
        public void TestConstructor()
        {
            var user                           = new User(1);
            var participantId                  = 100;
            var projectId                      = 1;
            var hostInstitutionId              = 200;
            var hostInstitutionAddressId       = 300;
            var homeInstitutionId              = 400;
            var homeInstitutionAddressId       = 500;
            var placementOrganizationId        = 600;
            var placementOrganizationAddressId = 700;
            var participantTypeId              = ParticipantType.Individual.Id;
            var participantStatusId            = ParticipantStatus.Active.Id;

            Assert.AreNotEqual(participantTypeId, participantStatusId);
            var instance = new UpdatedParticipantPerson(
                user,
                participantId,
                projectId,
                hostInstitutionId,
                homeInstitutionId,
                hostInstitutionAddressId,
                homeInstitutionAddressId,
                participantTypeId,
                participantStatusId,
                placementOrganizationId,
                placementOrganizationAddressId
                );

            Assert.AreEqual(homeInstitutionAddressId, instance.HomeInstitutionAddressId);
            Assert.AreEqual(homeInstitutionId, instance.HomeInstitutionId);
            Assert.AreEqual(hostInstitutionAddressId, instance.HostInstitutionAddressId);
            Assert.AreEqual(hostInstitutionId, instance.HostInstitutionId);
            Assert.AreEqual(participantId, instance.ParticipantId);
            Assert.AreEqual(participantStatusId, instance.ParticipantStatusId);
            Assert.AreEqual(participantTypeId, instance.ParticipantTypeId);
            Assert.AreEqual(projectId, instance.ProjectId);

            Assert.IsTrue(object.ReferenceEquals(user, instance.Audit.User));
            DateTimeOffset.UtcNow.Should().BeCloseTo(instance.Audit.Date, 20000);
        }