Пример #1
0
        public void SyncNameProvider_ContentTypeSet_GraphSyncPartSettingsReturned()
        {
            SyncNameProvider.ContentType = _contentType;

            GraphSyncPartSettings graphSyncPartSettings = SyncNameProvider.GraphSyncPartSettings;

            Assert.NotNull(graphSyncPartSettings);
        }
        private async Task <IEnumerable <string> > NodeLabels(GraphSyncPartSettings graphSyncPartSettings, string contentType)
        {
            //todo: rename NodeNameTransform to NodeLabelTransform
            string nodeLabel = graphSyncPartSettings.NodeNameTransform switch
            {
                "ContentType" => contentType,
                "$\"esco__{ContentType}\"" => $"esco__{contentType}",
                _ => await TransformOrDefault(graphSyncPartSettings.NodeNameTransform, contentType, contentType)
            };

            return(new[] { nodeLabel, CommonNodeLabel });
        }
        private async Task <string> GenerateIdPropertyValue(string contentType, GraphSyncPartSettings graphSyncPartSettings)
        {
            string newGuid = Guid.NewGuid().ToString("D");

            return(graphSyncPartSettings.GenerateIdPropertyValue switch
            {
                "$\"http://data.europa.eu/esco/{ContentType.ToLowerInvariant()}/{Value}\"" =>
                $"http://data.europa.eu/esco/{contentType.ToLowerInvariant()}/{newGuid}",

                "$\"<<contentapiprefix>>/{ContentType}/{Value}\".ToLowerInvariant()" =>
                $"<<contentapiprefix>>/{contentType.ToLowerInvariant()}/{newGuid}",

                _ => await TransformOrDefault(graphSyncPartSettings.GenerateIdPropertyValue, newGuid, contentType)
            });
 private string IdPropertyName(GraphSyncPartSettings graphSyncPartSettings)
 {
     return(graphSyncPartSettings.IdPropertyName ?? "userId");
 }