public void SetRestrictionProperties_AvailableDatasets_ShouldSetOpendDisplayText()
        {
            var list = new List <AvailableDatasetItem>();

            list.Add(new AvailableDatasetItem()
            {
                Classification = DatasetClassification.Open.ToString(), DatasetId = 1, AddedToSandbox = true
            });
            list.Add(new AvailableDatasetItem()
            {
                Classification = DatasetClassification.Open.ToString(), DatasetId = 2, AddedToSandbox = true
            });
            list.Add(new AvailableDatasetItem()
            {
                Classification = DatasetClassification.Open.ToString(), DatasetId = 3, AddedToSandbox = true
            });

            AvailableDatasets availableDatasets = new AvailableDatasets(list);

            availableDatasets.Datasets = list;

            DatasetClassificationUtils.SetRestrictionProperties(availableDatasets);

            Assert.Equal(DatasetConstants.DATASET_RESTRICTION_TEXT_OPEN, availableDatasets.RestrictionDisplayText);
        }
Exemplo n.º 2
0
        AvailableDatasets MapToAvailable(Sandbox sandbox)
        {
            var availableDatasets = sandbox.Study
                                    .StudyDatasets
                                    .Select(sd => new AvailableDatasetItem()
            {
                DatasetId      = sd.DatasetId,
                Name           = sd.Dataset.Name,
                Classification = sd.Dataset.Classification,
                AddedToSandbox = sd.Dataset.SandboxDatasets.Where(sd => sd.SandboxId == sandbox.Id).Any()
            });

            var result = new AvailableDatasets(availableDatasets);

            DatasetClassificationUtils.SetRestrictionProperties(result);

            return(result);
        }