Пример #1
0
        private DataCollection SetUpDataCollection(string userId)
        {
            var dataCollectionParties = Builder <DataCollectionParty> .CreateListOfSize(5)
                                        .TheFirst(1)
                                        .With(q => q.Party       = Builder <Party> .CreateNew().With(r => r.UserId = userId).Build())
                                        .And(q => q.Relationship = DataCollectionRelationshipType.Manager)
                                        .TheLast(4)
                                        .With(q => q.Party       = Builder <Party> .CreateNew().Build())
                                        .And(q => q.Relationship = PickHelper.RandomEnumExcept(DataCollectionRelationshipType.None, DataCollectionRelationshipType.Manager))
                                        .Build();

            var forCodes = Builder <DataCollectionFieldOfResearch> .CreateListOfSize(5)
                           .All()
                           .With(f => f.FieldOfResearch = Builder <FieldOfResearch> .CreateNew().Build())
                           .Build();

            var seoCodes = Builder <DataCollectionSocioEconomicObjective> .CreateListOfSize(5)
                           .All()
                           .With(f => f.SocioEconomicObjective = Builder <SocioEconomicObjective> .CreateNew().Build())
                           .Build();

            var dataCollection = Builder <DataCollection> .CreateNew()
                                 .Do(d => d.Parties.AddRange(dataCollectionParties))
                                 .And(d => d.FieldsOfResearch.AddRange(forCodes))
                                 .And(d => d.SocioEconomicObjectives.AddRange(seoCodes))
                                 .Build();

            return(dataCollection);
        }
        private Project SetUpFullProject(string curtinId)
        {
            var dmp = Builder <DataManagementPlan> .CreateNew()
                      .With(o => o.ExistingDataDetail = Builder <ExistingDataDetail> .CreateNew()
                                                        .With(q => q.UseExistingData        = PickHelper.RandomBoolean())
                                                        .And(q => q.ExistingDataAccessTypes = PickHelper.RandomEnumsExcept(ExistingDataAccessTypes.None))
                                                        .Build())
                      .And(o => o.BackupPolicy  = Builder <BackupPolicy> .CreateNew().Build())
                      .And(o => o.NewDataDetail = Builder <NewDataDetail> .CreateNew()
                                                  .With(q => q.DataOwners = PickHelper.RandomEnumsExcept(DataOwners.None))
                                                  .Build())
                      .And(o => o.DataRelationshipDetail = Builder <DataRelationshipDetail> .CreateNew()
                                                           .With(q => q.RelationshipBetweenExistingAndNewData = PickHelper.RandomEnumExcept(DataRelationship.None))
                                                           .Build())
                      .And(o => o.DataDocumentation = Builder <DataDocumentation> .CreateNew()
                                                      .Build())
                      .And(o => o.Ethic = Builder <Ethic> .CreateNew()
                                          .With(q => q.EthicRequiresClearance = PickHelper.RandomBoolean())
                                          .Build())
                      .And(o => o.Confidentiality = Builder <Confidentiality> .CreateNew()
                                                    .With(q => q.IsSensitive = PickHelper.RandomBoolean())
                                                    .Build())
                      .And(o => o.DataStorage = Builder <DataStorage> .CreateNew()
                                                .With(q => q.InstitutionalStorageTypes = PickHelper.RandomEnumExcept(InstitutionalStorageTypes.ProjectStorageSpace))
                                                .And(q => q.ExternalStorageTypes       = PickHelper.RandomEnumExcept(ExternalStorageTypes.None))
                                                .And(q => q.PersonalStorageTypes       = PickHelper.RandomEnumExcept(PersonalStorageTypes.None))
                                                .And(q => q.MaxDataSize    = PickHelper.RandomEnumExcept(MaxDataSize.None))
                                                .And(q => q.VersionControl = PickHelper.RandomEnumsExcept(VersionControl.None))
                                                .Build())
                      .And(o => o.DataRetention = Builder <DataRetention> .CreateNew()
                                                  .With(q => q.DataRetentionLocations       = PickHelper.RandomEnumExcept(DataRetentionLocations.None))
                                                  .And(q => q.DataRetentionResponsibilities = PickHelper.RandomEnumExcept(DataResponsibilities.None))
                                                  .And(q => q.DataRetentionPeriod           = PickHelper.RandomEnumExcept <DataRetentionPeriod>())
                                                  .Build())
                      .And(o => o.DataSharing = Builder <DataSharing> .CreateNew()
                                                .With(q => q.DataSharingAvailability    = PickHelper.RandomEnumExcept <DataSharingAvailability>())
                                                .And(q => q.DataSharingAvailabilityDate = DateTime.Today.AddYears(1))
                                                .And(q => q.ShareAccess       = PickHelper.RandomEnumExcept(ShareAccess.NoAccess))
                                                .And(q => q.DataLicensingType = PickHelper.RandomEnumExcept <DataLicensingType>())
                                                .Build())
                      .Build();

            var projectParties = Builder <ProjectParty> .CreateListOfSize(5)
                                 .TheFirst(1)
                                 .With(q => q.Party       = Builder <Party> .CreateNew().With(r => r.UserId = curtinId).Build())
                                 .And(q => q.Relationship = ProjectRelationship.PrincipalInvestigator)
                                 .TheLast(4)
                                 .With(q => q.Party       = Builder <Party> .CreateNew().Build())
                                 .And(q => q.Relationship = PickHelper.RandomEnumExcept(ProjectRelationship.None, ProjectRelationship.PrincipalInvestigator))
                                 .Build();

            var project = Builder <Project> .CreateNew()
                          .With(o => o.DataManagementPlan = dmp)
                          .And(o => o.Title = "Feeding habits of polarbears (2011)")
                          .And(o => o.ProvisioningStatus = PickHelper.RandomEnumExcept <ProvisioningStatus>())
                          .Do(o => o.Parties.AddRange(projectParties))
                          .Build();

            return(project);
        }
        public void Perform_review_submission_for_a_non_deposit_project()
        {
            // Arrange
            var vm = Builder <ConfirmDataManagementPlanViewModel>
                     .CreateNew()
                     .With(o => o.DataManagementPlanId = 1)
                     .Build();

            _project.SourceProjectType = PickHelper.RandomEnumExcept(SourceProjectType.DEPOSIT, SourceProjectType.None);
            _project.DataDeposit       = null;

            // Act
            _projectRepository.GetByDataManagementPlanId(Arg.Is(vm.DataManagementPlanId)).Returns(_project);


            _bus.When(c => c.Send(Arg.Any <Action <SiteRequestCommand> >()))
            .Do(a =>
            {
                var message = new SiteRequestCommand();
                var lambda  = a.Arg <Action <SiteRequestCommand> >();

                lambda(message);

                Assert.That(message.ProjectId, Is.EqualTo(_project.Id), "Invalid project id passed to the bus");
                Assert.That(message.ProjectDescription, Is.EqualTo(_project.Description), "Invalid project description passed to the bus");
                Assert.That(message.ProjectTitle, Is.EqualTo(_project.Title), "Invalid project name passed to the bus");
            });
            // Assert
            _controller.WithCallTo(c => c.Review(vm)).ShouldRedirectTo(_controller.GetType().GetMethod("Submitted"));
            // Saving a new data collection
            _dataCollectionRepository.Received().Save(Arg.Any <DataCollection>());
            _projectRepository.Received().GetByDataManagementPlanId(Arg.Is(vm.DataManagementPlanId));
        }
        private Project SetUpFullProjectWithAuthentication(string userId = "XX12345")
        {
            CreateUser(userId);
            var dmp = Builder <DataManagementPlan> .CreateNew()
                      .With(o => o.ExistingDataDetail = Builder <ExistingDataDetail> .CreateNew()
                                                        .With(q => q.UseExistingData        = PickHelper.RandomBoolean())
                                                        .And(q => q.ExistingDataAccessTypes = PickHelper.RandomEnumsExcept(ExistingDataAccessTypes.None))
                                                        .Build())
                      .And(o => o.NewDataDetail = Builder <NewDataDetail> .CreateNew()
                                                  .With(q => q.DataOwners = PickHelper.RandomEnumsExcept(DataOwners.None))
                                                  .Build())
                      .And(o => o.DataRelationshipDetail = Builder <DataRelationshipDetail> .CreateNew()
                                                           .With(q => q.RelationshipBetweenExistingAndNewData = PickHelper.RandomEnumExcept(DataRelationship.None))
                                                           .Build())
                      .And(o => o.DataDocumentation = Builder <DataDocumentation> .CreateNew()
                                                      .Build())
                      .And(o => o.Ethic = Builder <Ethic> .CreateNew()
                                          .With(q => q.EthicRequiresClearance = PickHelper.RandomBoolean())
                                          .Build())
                      .And(o => o.Confidentiality = Builder <Confidentiality> .CreateNew()
                                                    .With(q => q.IsSensitive = PickHelper.RandomBoolean())
                                                    .Build())
                      .And(o => o.DataStorage = Builder <DataStorage> .CreateNew()
                                                .With(q => q.InstitutionalStorageTypes = PickHelper.RandomEnumExcept(InstitutionalStorageTypes.ProjectStorageSpace))
                                                .And(q => q.ExternalStorageTypes       = PickHelper.RandomEnumExcept(ExternalStorageTypes.None))
                                                .And(q => q.PersonalStorageTypes       = PickHelper.RandomEnumExcept(PersonalStorageTypes.None))
                                                .And(q => q.MaxDataSize    = PickHelper.RandomEnumExcept(MaxDataSize.None))
                                                .And(q => q.VersionControl = PickHelper.RandomEnumsExcept(VersionControl.None))
                                                .Build())
                      .And(o => o.DataRetention = Builder <DataRetention> .CreateNew()
                                                  .With(q => q.DataRetentionLocations       = PickHelper.RandomEnumExcept(DataRetentionLocations.None))
                                                  .And(q => q.DataRetentionResponsibilities = PickHelper.RandomEnumExcept(DataResponsibilities.None))
                                                  .And(q => q.DataRetentionPeriod           = PickHelper.RandomEnumExcept <DataRetentionPeriod>())
                                                  .And(q => q.DepositToRepository           = PickHelper.RandomBoolean())
                                                  .Build())
                      .And(o => o.DataSharing = Builder <DataSharing> .CreateNew()
                                                .With(q => q.DataSharingAvailability    = PickHelper.RandomEnumExcept <DataSharingAvailability>())
                                                .And(q => q.DataSharingAvailabilityDate = DateTime.Today.AddYears(1))
                                                .And(q => q.ShareAccess       = PickHelper.RandomEnumExcept(ShareAccess.NoAccess))
                                                .And(q => q.DataLicensingType = PickHelper.RandomEnumExcept <DataLicensingType>())
                                                .Build())
                      .Build();


            var project = Builder <Project> .CreateNew()
                          .With(o => o.DataManagementPlan = dmp)
                          .And(o => o.ProvisioningStatus  = PickHelper.RandomEnumExcept <ProvisioningStatus>(ProvisioningStatus.Error, ProvisioningStatus.TimeOut))
                          .Do(o => o.Parties.Add(Builder <ProjectParty> .CreateNew()
                                                 .With(q => q.Party       = Builder <Party> .CreateNew().With(r => r.UserId = userId).Build())
                                                 .And(q => q.Relationship = ProjectRelationship.PrincipalInvestigator)
                                                 .Build()))
                          .Build();

            project.Parties.Do(o => o.Project = project);
            _projectRepository.GetByDataManagementPlanId(project.DataManagementPlan.Id).Returns(project);

            return(project);
        }
        public void Update_the_project()
        {
            var project = SetUpFullProjectWithAuthentication();

            var forCode = new ProjectFieldOfResearch
            {
                Code = Builder <FieldOfResearch> .CreateNew()
                       .With(o => o.Id  = Pick <string> .RandomItemFrom(new[] { "ABC", "DEF", "GHI" }))
                       .And(o => o.Name = string.Format("{0} Name", o.Id))
                       .Build()
            };

            var seoCode = new ProjectSocioEconomicObjective
            {
                Code = Builder <SocioEconomicObjective> .CreateNew()
                       .With(o => o.Id  = Pick <string> .RandomItemFrom(new[] { "XYZ", "RST", "UVW" }))
                       .And(o => o.Name = string.Format("{0} Name", o.Id))
                       .Build()
            };

            var vm = new ProjectDetailsViewModel
            {
                Id     = project.Id,
                Status = PickHelper.RandomEnumExcept(project.Status),
                // deliberately change the source type to an invalid one
                SourceProjectType       = PickHelper.RandomEnumExcept(project.SourceProjectType, SourceProjectType.None),
                EndDate                 = string.Format("{0:dd-MM-yyyy}", (project.EndDate ?? DateTime.Today).AddDays(10)),
                StartDate               = string.Format("{0:dd-MM-yyyy}", (project.StartDate ?? DateTime.Today).AddDays(-10)),
                Description             = "aut viam inveniam aut faciam",
                FieldsOfResearch        = project.FieldsOfResearch.Except(project.FieldsOfResearch.Take(1)).Union(new[] { forCode }).Cast <ClassificationBase>().ToList(),
                SocioEconomicObjectives = project.SocioEconomicObjectives.Except(project.SocioEconomicObjectives.Take(1)).Union(new[] { seoCode }).Cast <ClassificationBase>().ToList(),
                PrincipalInvestigator   = project.Parties.Single(o => o.Relationship == ProjectRelationship.PrincipalInvestigator).Party,
                ArcFunder               = new ArcProjectFunderViewModel {
                    GrantNumber = "BYC980", IsFunded = true
                },
                NmhrcFunder = new NmhrcProjectFunderViewModel {
                    IsFunded = false
                },
                Keywords = "other keywords",
                Title    = "crede quod habes, et habes"
            };

            _controller.WithCallTo(c => c.Project(vm)).ShouldRedirectTo <DmpController>(_dmpController.GetType().GetMethod("Edit", new[] { typeof(int), typeof(int) }));

            _projectRepository.Received().Save(Arg.Is <Project>(p => p.Description == vm.Description));
            _projectRepository.Received().Save(Arg.Is <Project>(p => p.Title == vm.Title));
            _projectRepository.Received().Save(Arg.Is <Project>(p => p.StartDate == DateTime.Parse(vm.StartDate)));
            _projectRepository.Received().Save(Arg.Is <Project>(p => p.EndDate == DateTime.Parse(vm.EndDate)));
            _projectRepository.Received().Save(Arg.Is <Project>(p => p.Keywords == vm.Keywords));
            _projectRepository.Received().Save(Arg.Is <Project>(p => p.Status == vm.Status));
            _projectRepository.Received().Save(Arg.Is <Project>(p => p.SourceProjectType == SourceProjectType.DMP));
            _projectRepository.Received().Save(Arg.Is <Project>(p => p.Funders.Count() == 1));
            _projectRepository.Received().Save(Arg.Is <Project>(p => p.Funders.Count(o => o.Funder == Funder.ARC && o.GrantNumber == vm.ArcFunder.GrantNumber) == 1));
            _projectRepository.Received().Save(Arg.Is <Project>(p => p.SocioEconomicObjectives.All(o => vm.SocioEconomicObjectives.Any(q => q.Code.Id == o.Code.Id))));
            _projectRepository.Received().Save(Arg.Is <Project>(p => p.FieldsOfResearch.All(o => vm.FieldsOfResearch.Any(q => q.Code.Id == o.Code.Id))));
        }
Пример #6
0
        public void Generate_Datatable_from_DataCollections()
        {
            const string userId = "GA37493";
            var          dataCollectionParties = Builder <DataCollectionParty> .CreateListOfSize(5)
                                                 .TheFirst(1)
                                                 .With(q => q.Party       = Builder <Party> .CreateNew().With(r => r.UserId = userId).Build())
                                                 .And(q => q.Relationship = DataCollectionRelationshipType.Manager)
                                                 .TheLast(4)
                                                 .With(q => q.Party       = Builder <Party> .CreateNew().Build())
                                                 .And(q => q.Relationship = PickHelper.RandomEnumExcept(DataCollectionRelationshipType.None, DataCollectionRelationshipType.Manager))
                                                 .Build();

            var forCodes = Builder <DataCollectionFieldOfResearch> .CreateListOfSize(5)
                           .All()
                           .With(f => f.FieldOfResearch = Builder <FieldOfResearch> .CreateNew().Build())
                           .Build();

            var seoCodes = Builder <DataCollectionSocioEconomicObjective> .CreateListOfSize(5)
                           .All()
                           .With(f => f.SocioEconomicObjective = Builder <SocioEconomicObjective> .CreateNew().Build())
                           .Build();

            var dataCollections = Builder <DataCollection> .CreateListOfSize(5)
                                  .All()
                                  .Do(d => d.Parties.AddRange(dataCollectionParties))
                                  .And(d => d.FieldsOfResearch.AddRange(forCodes))
                                  .And(d => d.SocioEconomicObjectives.AddRange(seoCodes))
                                  .Build();

            var dataCollectionTable = _csvHelper.DataCollectionsToDataTable(dataCollections);

            Assert.That(dataCollectionTable, Is.Not.Null);
            Assert.That(dataCollectionTable.Columns.Count, Is.EqualTo(DataCollectionColumnCount));
            Assert.That(dataCollectionTable.Rows.Count, Is.EqualTo(5));

            for (var index = 0; index < dataCollections.Count; index++)
            {
                var dataRow = dataCollectionTable.Rows[index];

                Assert.That(dataRow["Title"], Is.EqualTo(dataCollections[index].Title));
                Assert.That(dataRow["Type"], Is.EqualTo(dataCollections[index].Type.ToString()));
                Assert.That(dataRow["StartDate"], Is.EqualTo(dataCollections[index].StartDate));
                Assert.That(dataRow["DataLicensingRights"], Is.EqualTo(dataCollections[index].DataLicensingRights.ToString()));
                Assert.That(dataRow["ShareAccess"], Is.EqualTo(dataCollections[index].ShareAccess.ToString()));

                var parties = dataRow["Parties"].ToString().Split('%');
                Assert.That(parties.Length, Is.EqualTo(dataCollections[index].Parties.Count));

                var seoCodeStrings = dataRow["SocioEconomicObjectives"].ToString().Split('%');
                Assert.That(seoCodeStrings.Length, Is.EqualTo(dataCollections[index].SocioEconomicObjectives.Count));

                var forCodeStrings = dataRow["FieldsOfResearch"].ToString().Split('%');
                Assert.That(forCodeStrings.Length, Is.EqualTo(dataCollections[index].FieldsOfResearch.Count));
            }
        }
        public void Render_view_for_an_existing_project()
        {
            const string userId = "XX12345";

            CreateUser(userId);
            var project = Builder <Project> .CreateNew()
                          .With(o => o.SourceProjectType = PickHelper.RandomEnumExcept(SourceProjectType.None, SourceProjectType.DEPOSIT))
                          .Do(o => o.Parties.Add(Builder <ProjectParty> .CreateNew()
                                                 .With(q => q.Party       = Builder <Party> .CreateNew().With(r => r.UserId = userId).Build())
                                                 .And(q => q.Relationship = ProjectRelationship.PrincipalInvestigator)
                                                 .Build()))
                          .Build();

            _projectRepository.Get(project.Id).Returns(project);
            _controller.WithCallTo(c => c.Project(project.Id))
            .ShouldRenderView("Project")
            .WithModel <ProjectDetailsViewModel>();
        }
        public void Update_the_project_entity_when_saving_at_step4()
        {
            const int step = 4;

            _form["stepAction"] = "Save and Next";
            var project     = SetUpFullProjectWithAuthentication();
            var dmp         = project.DataManagementPlan;
            var dataStorage = Builder <DataStorageViewModel> .CreateNew()
                              .With(o => o.InstitutionalStorageTypes        = PickHelper.RandomEnumsExcept(InstitutionalStorageTypes.ProjectStorageSpace, dmp.DataStorage.InstitutionalStorageTypes))
                              .And(o => o.InstitutionalOtherTypeDescription = "Updated Institutional Other Type Description")
                              .And(o => o.ExternalStorageTypes         = PickHelper.RandomEnumsExcept(ExternalStorageTypes.Other, dmp.DataStorage.ExternalStorageTypes))
                              .And(o => o.ExternalOtherTypeDescription = "Updated External Other Type Description")
                              .And(o => o.PersonalStorageTypes         = PickHelper.RandomEnumsExcept(PersonalStorageTypes.None, dmp.DataStorage.PersonalStorageTypes))
                              .And(o => o.PersonalOtherTypeDescription = "Updated Personal Other Type Description")
                              .And(o => o.MaxDataSize               = PickHelper.RandomEnumExcept(MaxDataSize.None, dmp.DataStorage.MaxDataSize))
                              .And(o => o.FileFormats               = "Updated File Formats")
                              .And(o => o.VersionControl            = PickHelper.RandomEnumsExcept(dmp.DataStorage.VersionControl, VersionControl.None))
                              .And(o => o.VersionControlDescription = "Updated Version Control Description")
                              .Build();

            var vm = Builder <DataManagementPlanViewModel> .CreateNew()
                     .With(o => o.Id          = dmp.Id)
                     .And(o => o.ProjectId    = project.Id)
                     .And(o => o.ProjectTitle = project.Title)
                     .And(o => o.DataStorage  = dataStorage)
                     .And(o => o.Step         = step)
                     .Build();

            var methodInfo = _controller.GetType().GetMethod("Edit", new[] { typeof(int), typeof(int) });

            Assert.That(methodInfo, Is.Not.Null);
            _controller.WithCallTo(x => x.Edit(vm)).ShouldRedirectTo(methodInfo);

            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataStorage.InstitutionalOtherTypeDescription == dataStorage.InstitutionalOtherTypeDescription));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataStorage.InstitutionalStorageTypes == dataStorage.InstitutionalStorageTypes));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataStorage.ExternalOtherTypeDescription == dataStorage.ExternalOtherTypeDescription));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataStorage.ExternalStorageTypes == dataStorage.ExternalStorageTypes));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataStorage.PersonalOtherTypeDescription == dataStorage.PersonalOtherTypeDescription));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataStorage.PersonalStorageTypes == dataStorage.PersonalStorageTypes));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataStorage.VersionControl == dataStorage.VersionControl));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataStorage.VersionControlDescription == dataStorage.VersionControlDescription));
        }
Пример #9
0
        public void Generate_Datatable_from_DataManagementPlans()
        {
            const string userId         = "GA37493";
            var          projectParties = Builder <ProjectParty> .CreateListOfSize(5)
                                          .TheFirst(1)
                                          .With(q => q.Party       = Builder <Party> .CreateNew().With(r => r.UserId = userId).Build())
                                          .And(q => q.Relationship = ProjectRelationship.PrincipalInvestigator)
                                          .TheLast(4)
                                          .With(q => q.Party       = Builder <Party> .CreateNew().Build())
                                          .And(q => q.Relationship = PickHelper.RandomEnumExcept(ProjectRelationship.None, ProjectRelationship.PrincipalInvestigator))
                                          .Build();

            var dataManagementPlan = Builder <DataManagementPlan> .CreateNew()
                                     .With(o => o.ExistingDataDetail = Builder <ExistingDataDetail> .CreateNew()
                                                                       .With(q => q.UseExistingData        = PickHelper.RandomBoolean())
                                                                       .And(q => q.ExistingDataAccessTypes = PickHelper.RandomEnumsExcept(ExistingDataAccessTypes.None))
                                                                       .Build())
                                     .And(o => o.BackupPolicy  = Builder <BackupPolicy> .CreateNew().Build())
                                     .And(o => o.NewDataDetail = Builder <NewDataDetail> .CreateNew()
                                                                 .With(q => q.DataOwners = PickHelper.RandomEnumsExcept(DataOwners.None))
                                                                 .Build())
                                     .And(o => o.DataRelationshipDetail = Builder <DataRelationshipDetail> .CreateNew()
                                                                          .With(q => q.RelationshipBetweenExistingAndNewData = PickHelper.RandomEnumExcept(DataRelationship.None))
                                                                          .Build())
                                     .And(o => o.DataDocumentation = Builder <DataDocumentation> .CreateNew()
                                                                     .Build())
                                     .And(o => o.Ethic = Builder <Ethic> .CreateNew()
                                                         .With(q => q.EthicRequiresClearance = PickHelper.RandomBoolean())
                                                         .Build())
                                     .And(o => o.Confidentiality = Builder <Confidentiality> .CreateNew()
                                                                   .With(q => q.IsSensitive = PickHelper.RandomBoolean())
                                                                   .Build())
                                     .And(o => o.DataStorage = Builder <DataStorage> .CreateNew()
                                                               .With(q => q.InstitutionalStorageTypes = PickHelper.RandomEnumExcept(InstitutionalStorageTypes.ProjectStorageSpace))
                                                               .And(q => q.ExternalStorageTypes       = PickHelper.RandomEnumExcept(ExternalStorageTypes.None))
                                                               .And(q => q.PersonalStorageTypes       = PickHelper.RandomEnumExcept(PersonalStorageTypes.None))
                                                               .And(q => q.MaxDataSize    = PickHelper.RandomEnumExcept(MaxDataSize.None))
                                                               .And(q => q.VersionControl = PickHelper.RandomEnumsExcept(VersionControl.None))
                                                               .Build())
                                     .And(o => o.DataRetention = Builder <DataRetention> .CreateNew()
                                                                 .With(q => q.DataRetentionLocations       = PickHelper.RandomEnumExcept(DataRetentionLocations.None))
                                                                 .And(q => q.DataRetentionResponsibilities = PickHelper.RandomEnumExcept(DataResponsibilities.None))
                                                                 .And(q => q.DataRetentionPeriod           = PickHelper.RandomEnumExcept <DataRetentionPeriod>())
                                                                 .Build())
                                     .And(o => o.DataSharing = Builder <DataSharing> .CreateNew()
                                                               .With(q => q.DataSharingAvailability    = PickHelper.RandomEnumExcept <DataSharingAvailability>())
                                                               .And(q => q.DataSharingAvailabilityDate = DateTime.Today.AddYears(1))
                                                               .And(q => q.ShareAccess       = PickHelper.RandomEnumExcept(ShareAccess.NoAccess))
                                                               .And(q => q.DataLicensingType = PickHelper.RandomEnumExcept <DataLicensingType>())
                                                               .Build())
                                     .Build();

            var projects = Builder <Project> .CreateListOfSize(5)
                           .All()
                           .With(o => o.DataManagementPlan = dataManagementPlan)
                           .And(o => o.ProvisioningStatus  = PickHelper.RandomEnumExcept <ProvisioningStatus>())
                           .Do(o => o.Parties.AddRange(projectParties))
                           .Build();

            var dataManagementPlansTable = _csvHelper.DataManagementPlansToDataTable(projects);

            Assert.That(dataManagementPlansTable, Is.Not.Null);
            Assert.That(dataManagementPlansTable.Columns.Count, Is.EqualTo(DataManagementColumnCount), "Incorrect number of columns");
            Assert.That(dataManagementPlansTable.Rows.Count, Is.EqualTo(5));

            for (var index = 0; index < projects.Count; index++)
            {
                var dmp     = projects[index].DataManagementPlan;
                var dataRow = dataManagementPlansTable.Rows[index];

                Assert.That(dataRow["ExistingDataAccessTypes"], Is.EqualTo(dmp.ExistingDataDetail.ExistingDataAccessTypes.ToString()));
                Assert.That(dataRow["ExistingDataOwner"], Is.EqualTo(dmp.ExistingDataDetail.ExistingDataOwner));
                Assert.That(dataRow["InstitutionalOtherTypeDescription"], Is.EqualTo(dmp.DataStorage.InstitutionalOtherTypeDescription));
                Assert.That(dataRow["DataRetentionLocations"], Is.EqualTo(dmp.DataRetention.DataRetentionLocations.ToString()));
                Assert.That(dataRow["VersionControl"], Is.EqualTo(dmp.DataStorage.VersionControl.ToString()));
                Assert.That(dataRow["EthicRequiresClearance"], Is.EqualTo(dmp.Ethic.EthicRequiresClearance));
                Assert.That(dataRow["ConfidentialityComments"], Is.EqualTo(dmp.Confidentiality.ConfidentialityComments));
                Assert.That(dataRow["RelationshipBetweenExistingAndNewData"], Is.EqualTo(dmp.DataRelationshipDetail.RelationshipBetweenExistingAndNewData.ToString()));
                Assert.That(dataRow["DataSharingAvailabilityDate"], Is.EqualTo(dmp.DataSharing.DataSharingAvailabilityDate));

                var parties = dataRow["AccessRoles"].ToString().Split('%');
                Assert.That(parties.Length, Is.EqualTo(5));
            }
        }
        private Project SetUpFullProjectWithAuthentication(string userId = "XX12345")
        {
            CreateUser(userId);
            var dmp = Builder <DataManagementPlan> .CreateNew()
                      .With(o => o.ExistingDataDetail = Builder <ExistingDataDetail> .CreateNew()
                                                        .With(q => q.UseExistingData        = PickHelper.RandomBoolean())
                                                        .And(q => q.ExistingDataAccessTypes = PickHelper.RandomEnumsExcept(ExistingDataAccessTypes.None))
                                                        .Build())
                      .And(o => o.NewDataDetail = Builder <NewDataDetail> .CreateNew()
                                                  .With(q => q.DataOwners = PickHelper.RandomEnumsExcept(DataOwners.None))
                                                  .Build())
                      .And(o => o.DataRelationshipDetail = Builder <DataRelationshipDetail> .CreateNew()
                                                           .With(q => q.RelationshipBetweenExistingAndNewData = PickHelper.RandomEnumExcept(DataRelationship.None))
                                                           .Build())
                      .And(o => o.DataDocumentation = Builder <DataDocumentation> .CreateNew()
                                                      .Build())
                      .And(o => o.Ethic = Builder <Ethic> .CreateNew()
                                          .With(q => q.EthicRequiresClearance = PickHelper.RandomBoolean())
                                          .Build())
                      .And(o => o.Confidentiality = Builder <Confidentiality> .CreateNew()
                                                    .With(q => q.IsSensitive = PickHelper.RandomBoolean())
                                                    .Build())
                      .And(o => o.DataStorage = Builder <DataStorage> .CreateNew()
                                                .With(q => q.InstitutionalStorageTypes = PickHelper.RandomEnumExcept(InstitutionalStorageTypes.ProjectStorageSpace))
                                                .And(q => q.ExternalStorageTypes       = PickHelper.RandomEnumExcept(ExternalStorageTypes.None))
                                                .And(q => q.PersonalStorageTypes       = PickHelper.RandomEnumExcept(PersonalStorageTypes.None))
                                                .And(q => q.MaxDataSize    = PickHelper.RandomEnumExcept(MaxDataSize.None))
                                                .And(q => q.VersionControl = PickHelper.RandomEnumsExcept(VersionControl.None))
                                                .Build())
                      .And(o => o.DataRetention = Builder <DataRetention> .CreateNew()
                                                  .With(q => q.DataRetentionLocations       = PickHelper.RandomEnumExcept(DataRetentionLocations.None))
                                                  .And(q => q.DataRetentionResponsibilities = PickHelper.RandomEnumExcept(DataResponsibilities.None))
                                                  .And(q => q.DataRetentionPeriod           = PickHelper.RandomEnumExcept <DataRetentionPeriod>())
                                                  .And(q => q.DepositToRepository           = PickHelper.RandomBoolean())
                                                  .Build())
                      .And(o => o.DataSharing = Builder <DataSharing> .CreateNew()
                                                .With(q => q.DataSharingAvailability    = PickHelper.RandomEnumExcept <DataSharingAvailability>())
                                                .And(q => q.DataSharingAvailabilityDate = DateTime.Today.AddYears(1))
                                                .And(q => q.ShareAccess       = PickHelper.RandomEnumExcept(ShareAccess.NoAccess))
                                                .And(q => q.DataLicensingType = PickHelper.RandomEnumExcept <DataLicensingType>())
                                                .Build())
                      .Build();

            var socioEconomicObjectives = Builder <SocioEconomicObjective> .CreateListOfSize(5).Build();

            var fieldsOfResearch = Builder <FieldOfResearch> .CreateListOfSize(6).Build();

            var parties = Builder <Party> .CreateListOfSize(7)
                          .TheFirst(1)
                          .With(o => o.UserId   = userId)
                          .And(o => o.FirstName = Pick <string> .RandomItemFrom(new[] { "Alan", "Albert", "Adrian" }))
                          .And(o => o.LastName  = Pick <string> .RandomItemFrom(new[] { "Wallace", "Willis", "Waylan" }))
                          .TheNext(3)
                          .And(o => o.FirstName = Pick <string> .RandomItemFrom(new[] { "Bastian", "Bruce", "Brian", "Julian", "James", "Jones" }))
                          .And(o => o.LastName  = Pick <string> .RandomItemFrom(new[] { "Dallas", "Donga", "Dulles", "Frost", "Feller", "Frist" }))
                          .TheNext(3)
                          .With(o => o.UserId      = null)
                          .And(o => o.Organisation = null)
                          .And(o => o.Email        = null)
                          .And(o => o.FirstName    = Pick <string> .RandomItemFrom(new[] { "George", "Gerald", "Gordon", "Hally", "Harvey", "Harry" }))
                          .And(o => o.LastName     = Pick <string> .RandomItemFrom(new [] { "Pepper", "Prince", "Pulse", "Tommy", "Thors", "Tallis" }))
                          .All()
                          .With(o => o.FullName = string.Format("{0} {1}", o.FirstName, o.LastName))
                          .TheFirst(4)
                          .With(o => o.Organisation = "Your University")
                          .And(o => o.Email         = string.Format("{0}.{1}@domain.edu.au", o.FirstName, o.LastName))
                          .Build();


            var project = Builder <Project> .CreateNew()
                          .With(o => o.DataManagementPlan = dmp)
                          .And(o => o.ProvisioningStatus  = PickHelper.RandomEnumExcept <ProvisioningStatus>())
                          .And(o => o.Status            = PickHelper.RandomEnumExcept(ProjectStatus.Completed))
                          .And(o => o.SourceProjectType = SourceProjectType.DMP)
                          .And(o => o.StartDate         = DateTime.Today.AddMonths(-3))
                          .And(o => o.EndDate           = DateTime.Today.AddMonths(9))
                          .Do(o =>
            {
                o.Parties.AddRange(Builder <ProjectParty> .CreateListOfSize(parties.Count)
                                   .All()
                                   .With(q => q.Party = parties[q.Id - 1])
                                   .TheFirst(1)
                                   .With(q => q.Relationship = ProjectRelationship.PrincipalInvestigator)
                                   .And(q => q.Role          = AccessRole.Owners)
                                   .TheNext(3)
                                   .With(q => q.Relationship = Pick <ProjectRelationship> .RandomItemFrom(new[] { ProjectRelationship.Student, ProjectRelationship.SupportStaff, ProjectRelationship.Investigator, ProjectRelationship.PartnerInvestigator }))
                                   .And(q => q.Role          = Pick <AccessRole> .RandomItemFrom(new[] { AccessRole.Members, AccessRole.Visitors }))
                                   .TheNext(3)
                                   .With(q => q.Relationship = ProjectRelationship.ExternalResearcher)
                                   .And(q => q.Role          = Pick <AccessRole> .RandomItemFrom(new[] { AccessRole.Members, AccessRole.Visitors }))
                                   .Build()
                                   );

                o.SocioEconomicObjectives.AddRange(Builder <ProjectSocioEconomicObjective> .CreateListOfSize(socioEconomicObjectives.Count)
                                                   .All()
                                                   .With(q => q.Code = socioEconomicObjectives[q.Id - 1])
                                                   .Build());

                o.FieldsOfResearch.AddRange(Builder <ProjectFieldOfResearch> .CreateListOfSize(fieldsOfResearch.Count)
                                            .All()
                                            .With(q => q.Code = fieldsOfResearch[q.Id = 1])
                                            .Build());

                o.Funders.AddRange(Builder <ProjectFunder> .CreateListOfSize(2)
                                   .TheFirst(1)
                                   .With(q => q.Funder = Funder.ARC)
                                   .TheLast(1)
                                   .With(q => q.Funder = Funder.NMHRC)
                                   .All()
                                   .With(q => q.GrantNumber = Pick <string> .RandomItemFrom(new[] { "ABC123", "DEF456", "GHI789" }))
                                   .Build());
            }).Build();

            project.Parties.Do(o => o.Project = project);
            _projectRepository.Get(Arg.Is(project.Id)).Returns(project);

            return(project);
        }
Пример #11
0
        private Project SetUpFullProjectWithAuthentication(string userId = "XX12345")
        {
            CreateUser(userId);
            var dataDeposit = Builder <DataDeposit> .CreateNew()
                              .With(o => o.Availability        = DataSharingAvailability.AfterASpecifiedEmbargoPeriod)
                              .And(o => o.AvailabilityDate     = DateTime.Today.AddMonths(9))
                              .And(o => o.LicensingArrangement = PickHelper.RandomEnumExcept <DataLicensingType>())
                              .And(o => o.MaxDataSize          = PickHelper.RandomEnumExcept(MaxDataSize.None))
                              .And(o => o.ShareAccess          = PickHelper.RandomEnumExcept(ShareAccess.NoAccess))
                              .Build();

            var socioEconomicObjectives = Builder <SocioEconomicObjective> .CreateListOfSize(5).Build();

            var fieldsOfResearch = Builder <FieldOfResearch> .CreateListOfSize(6).Build();

            var parties = Builder <Party> .CreateListOfSize(7)
                          .TheFirst(1)
                          .With(o => o.UserId   = userId)
                          .And(o => o.FirstName = Pick <string> .RandomItemFrom(new[] { "Alan", "Albert", "Adrian" }))
                          .And(o => o.LastName  = Pick <string> .RandomItemFrom(new[] { "Wallace", "Willis", "Waylan" }))
                          .TheNext(3)
                          .And(o => o.FirstName = Pick <string> .RandomItemFrom(new[] { "Bastian", "Bruce", "Brian", "Julian", "James", "Jones" }))
                          .And(o => o.LastName  = Pick <string> .RandomItemFrom(new[] { "Dallas", "Donga", "Dulles", "Frost", "Feller", "Frist" }))
                          .TheNext(3)
                          .With(o => o.UserId      = null)
                          .And(o => o.Organisation = null)
                          .And(o => o.Email        = null)
                          .And(o => o.FirstName    = Pick <string> .RandomItemFrom(new[] { "George", "Gerald", "Gordon", "Hally", "Harvey", "Harry" }))
                          .And(o => o.LastName     = Pick <string> .RandomItemFrom(new[] { "Pepper", "Prince", "Pulse", "Tommy", "Thors", "Tallis" }))
                          .All()
                          .With(o => o.FullName = string.Format("{0} {1}", o.FirstName, o.LastName))
                          .TheFirst(4)
                          .With(o => o.Organisation = "Your University")
                          .And(o => o.Email         = string.Format("{0}.{1}@yourdomain.edu.au", o.FirstName, o.LastName))
                          .Build();


            var project = Builder <Project> .CreateNew()
                          .With(o => o.DataDeposit       = dataDeposit)
                          .And(o => o.ProvisioningStatus = PickHelper.RandomEnumExcept <ProvisioningStatus>())
                          .And(o => o.Status             = ProjectStatus.Completed)
                          .And(o => o.SourceProjectType  = SourceProjectType.DEPOSIT)
                          .And(o => o.StartDate          = DateTime.Today.AddMonths(-3))
                          .And(o => o.EndDate            = DateTime.Today.AddMonths(9))
                          .Do(o =>
            {
                o.Parties.AddRange(Builder <ProjectParty> .CreateListOfSize(parties.Count)
                                   .All()
                                   .With(q => q.Party = parties[q.Id - 1])
                                   .TheFirst(1)
                                   .With(q => q.Relationship = ProjectRelationship.PrincipalInvestigator)
                                   .And(q => q.Role          = AccessRole.Owners)
                                   .TheNext(3)
                                   .With(q => q.Relationship = Pick <ProjectRelationship> .RandomItemFrom(new[] { ProjectRelationship.Student, ProjectRelationship.SupportStaff, ProjectRelationship.Investigator, ProjectRelationship.PartnerInvestigator }))
                                   .And(q => q.Role          = Pick <AccessRole> .RandomItemFrom(new[] { AccessRole.Members, AccessRole.Visitors }))
                                   .TheNext(3)
                                   .With(q => q.Relationship = ProjectRelationship.ExternalResearcher)
                                   .And(q => q.Role          = Pick <AccessRole> .RandomItemFrom(new[] { AccessRole.Members, AccessRole.Visitors }))
                                   .Build()
                                   );

                o.SocioEconomicObjectives.AddRange(Builder <ProjectSocioEconomicObjective> .CreateListOfSize(socioEconomicObjectives.Count)
                                                   .All()
                                                   .With(q => q.Code = socioEconomicObjectives[q.Id - 1])
                                                   .Build());

                o.FieldsOfResearch.AddRange(Builder <ProjectFieldOfResearch> .CreateListOfSize(fieldsOfResearch.Count)
                                            .All()
                                            .With(q => q.Code = fieldsOfResearch[q.Id = 1])
                                            .Build());
            }).Build();

            _projectRepository.Get(Arg.Is(project.Id)).Returns(project);

            return(project);
        }
        public void Update_the_project_entity_when_saving_at_step5()
        {
            const int step = 5;

            _form["stepAction"] = "Save and Next";
            var project       = SetUpFullProjectWithAuthentication();
            var dmp           = project.DataManagementPlan;
            var dataRetention = Builder <DataRetentionViewModel> .CreateNew()
                                .With(o => o.DataRetentionLocations           = PickHelper.RandomEnumsExcept(DataRetentionLocations.None))
                                .And(o => o.DataRetentionLocationsDescription = "Updated Locations Description")
                                .And(o => o.DataRetentionPeriod                      = PickHelper.RandomEnumExcept(dmp.DataRetention.DataRetentionPeriod))
                                .And(o => o.DataRetentionResponsibilities            = PickHelper.RandomEnumsExcept(DataResponsibilities.None))
                                .And(o => o.DataRetentionResponsibilitiesDescription = "Updated Responsibilities Description")
                                .And(o => o.DepositToRepository                      = !project.DataManagementPlan.DataRetention.DepositToRepository)
                                .Build();

            var dataSharing = Builder <DataSharingViewModel> .CreateNew()
                              .With(o => o.DataSharingAvailability    = PickHelper.RandomEnumExcept(dmp.DataSharing.DataSharingAvailability))
                              .And(o => o.DataSharingAvailabilityDate = DateTime.Today)
                              .And(o => o.DataLicensingType           = PickHelper.RandomEnumExcept(dmp.DataSharing.DataLicensingType))
                              .And(o => o.ReuseByOrganisations        = "Updated Reuse By Organisations")
                              .And(o => o.ShareAccess            = PickHelper.RandomEnumExcept(ShareAccess.NoAccess, dmp.DataSharing.ShareAccess))
                              .And(o => o.ShareAccessDescription = "Updated Share Access Description")
                              .Build();

            var vm = Builder <DataManagementPlanViewModel> .CreateNew()
                     .With(o => o.Id           = dmp.Id)
                     .And(o => o.ProjectId     = project.Id)
                     .And(o => o.ProjectTitle  = project.Title)
                     .And(o => o.DataRetention = dataRetention)
                     .And(o => o.DataSharing   = dataSharing)
                     .And(o => o.Step          = step)
                     .Build();

            string actionName;

            switch (project.ProvisioningStatus)
            {
            case ProvisioningStatus.NotStarted:
                actionName = "Review";
                break;

            case ProvisioningStatus.Pending:
                actionName = "Pending";
                break;

            case ProvisioningStatus.Provisioned:
                actionName = "Republish";
                break;

            default:
                throw new InvalidOperationException("Unknown provisioning status");
            }

            Console.WriteLine("actionName: {0}", actionName);
            var methodInfo = typeof(ConfirmController).GetMethod(actionName, new[] { typeof(int) });

            Assert.That(methodInfo, Is.Not.Null);

            _controller.WithCallTo(x => x.Confirm(vm)).ShouldRedirectTo <ConfirmController>(methodInfo);

            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataRetention.DataRetentionLocations == dataRetention.DataRetentionLocations));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataRetention.DataRetentionLocationsDescription == dataRetention.DataRetentionLocationsDescription));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataRetention.DataRetentionPeriod == dataRetention.DataRetentionPeriod));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataRetention.DataRetentionResponsibilities == dataRetention.DataRetentionResponsibilities));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataRetention.DataRetentionResponsibilitiesDescription == dataRetention.DataRetentionResponsibilitiesDescription));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataRetention.DepositToRepository == dataRetention.DepositToRepository));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataSharing.DataSharingAvailability == dataSharing.DataSharingAvailability));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataSharing.DataSharingAvailabilityDate == dataSharing.DataSharingAvailabilityDate));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataSharing.DataLicensingType == dataSharing.DataLicensingType));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataSharing.ReuseByOrganisations == dataSharing.ReuseByOrganisations));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataSharing.ShareAccess == dataSharing.ShareAccess));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataSharing.ShareAccessDescription == dataSharing.ShareAccessDescription));
        }
        public void Update_the_project_entity_when_saving_at_step1()
        {
            const int step = 1;

            _form["stepAction"] = "Save and Next";
            var project            = SetUpFullProjectWithAuthentication();
            var dmp                = project.DataManagementPlan;
            var existingDataDetail = Builder <ExistingDataDetailViewModel> .CreateNew()
                                     .With(o => o.UseExistingData        = !dmp.ExistingDataDetail.UseExistingData)
                                     .And(o => o.AccessTypesDescription  = "Updated Access Types Description")
                                     .And(o => o.ExistingDataAccessTypes = PickHelper.RandomEnumsExcept(ExistingDataAccessTypes.None))
                                     .And(o => o.ExistingDataOwner       = "Updated Owner")
                                     .Build();

            var newDataDetail = Builder <NewDataDetailViewModel> .CreateNew()
                                .With(o => o.DataOwners             = PickHelper.RandomEnumsExcept(DataOwners.None))
                                .And(o => o.ResearchDataDescription = "Updated Research Data Description")
                                .Build();

            var dataRelationshipDetail = Builder <DataRelationshipDetailViewModel> .CreateNew()
                                         .With(o => o.RelationshipBetweenExistingAndNewData = PickHelper
                                                                                              .RandomEnumExcept(dmp.DataRelationshipDetail.RelationshipBetweenExistingAndNewData, DataRelationship.None))
                                         .Build();

            var vm = Builder <DataManagementPlanViewModel> .CreateNew()
                     .With(o => o.Id                    = dmp.Id)
                     .And(o => o.ProjectId              = project.Id)
                     .And(o => o.ProjectTitle           = project.Title)
                     .And(o => o.Step                   = step)
                     .And(o => o.ExistingDataDetail     = existingDataDetail)
                     .And(o => o.NewDataDetail          = newDataDetail)
                     .And(o => o.DataRelationshipDetail = dataRelationshipDetail)
                     .Build();

            var methodInfo = _controller.GetType().GetMethod("Edit", new[] { typeof(int), typeof(int) });

            Assert.That(methodInfo, Is.Not.Null);
            _controller.WithCallTo(x => x.Edit(vm)).ShouldRedirectTo(methodInfo);

            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.NewDataDetail.DataOwners == newDataDetail.DataOwners));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.NewDataDetail.ResearchDataDescription == newDataDetail.ResearchDataDescription));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.DataRelationshipDetail.RelationshipBetweenExistingAndNewData == dataRelationshipDetail.RelationshipBetweenExistingAndNewData));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.ExistingDataDetail.UseExistingData == existingDataDetail.UseExistingData));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.ExistingDataDetail.AccessTypesDescription == existingDataDetail.AccessTypesDescription));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.ExistingDataDetail.ExistingDataAccessTypes == existingDataDetail.ExistingDataAccessTypes));
            _projectRepository.Received().Save(Arg.Is <Project>(o => o.DataManagementPlan.ExistingDataDetail.ExistingDataOwner == existingDataDetail.ExistingDataOwner));
        }