Пример #1
0
        public static Dictionary <string, ExchangeMappingProperties> GetExchangeMapping(string mode)
        {
            var mappingProperties = new Dictionary <string, ExchangeMappingProperties>()
            {
            };

            foreach (string resource in Enum.GetNames(typeof(TestCoreFramework.Enums.ResourceType)))
            {
                var resourceName = resource == TestCoreFramework.Enums.ResourceType.Candidate.ToString() ? "Person" : resource;
                mappingProperties.Add(resourceName, ExchangeMappingProperties.GetMappingContent(
                                          mode.ToLower(),
                                          0,
                                          $"{LabelName}{resource}",
                                          $"{LabelName}{resource}",
                                          resource,
                                          resource,
                                          mode == Mode.Import.ToString() ? new List <string> {
                    $"{resourceName}.P_Id"
                } : null,
                                          GetLabels(mode, resourceName),
                                          GetGroups(mode, resourceName),
                                          GetItems(mode, resourceName),
                                          GetConverters(mode, resourceName),
                                          mode == Mode.Export.ToString() ? new List <string>()
                {
                    "10001"
                } : null));
            }

            return(mappingProperties);
        }
Пример #2
0
        public void ExchangeMappingInvalidContentTest(string mode, ContentParam contentParam, InvalidContent invalidContent, int expectedCode)
        {
            ExchangeMappingProperties requestBody = ExchangeMappingProperties.GetMappingContent(mode, mode == "import" ? CreatedImportMapping.Data : CreatedExportMapping.Data, Label, Name, Group, Resource, new List <string> {
                "Client.P_Id"
            }, Labels, GroupsDic, Items, AdditionConverters);
            var mappingHandler = new MappingManager();
            var response       = mappingHandler.ExchangeMapping <object>(InvalidContentMapper[contentParam](requestBody, invalidContent), System.Net.Http.HttpMethod.Put);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest).And.ErrorCode(100).Or.ErrorCode(116).Or.ErrorCode(103));
        }
Пример #3
0
        private void SendRequestAndVerify(string mode, Func <ExchangeMappingProperties, IEnumerable <KeyValuePair <string, object> > > getRequest, System.Net.HttpStatusCode statusCode, int expectedCode)
        {
            ExchangeMappingProperties requestBody = ExchangeMappingProperties.GetMappingContent(mode, mode == "import" ? CreatedImportMapping.Data : CreatedExportMapping.Data, Label, Name, Group, Resource, new List <string> {
                "Client.P_Id"
            }, Labels, GroupsDic, Items, AdditionConverters);
            var mappingHandler = new MappingManager();
            var response       = mappingHandler.ExchangeMapping <object>(getRequest(requestBody), System.Net.Http.HttpMethod.Put);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(statusCode).And.ErrorCode(expectedCode));
        }
Пример #4
0
        public static ExchangeMappingProperties GetDefaultExchangeMapping(Common.Mode mode, ResourceId resourceId, int mappingId = 0)
        {
            string resourceName = resourceId == ResourceId.Person ? "candidate" : resourceId.ToString().ToLower();

            return(mode == Common.Mode.Import ? ExchangeMappingProperties.GetMappingContent(mode.ToString().ToLower(), mappingId, "label", "name", resourceName, resourceName, Common.GetDefaultKeys(resourceId),
                                                                                            Common.GetDefaultImportLabels(),
                                                                                            Common.GetDefaultImportGroups(resourceId),
                                                                                            Common.GetDefaultImportItems(), Common.GetDefaultImportConverters()) :
                   ExchangeMappingProperties.GetMappingContent(mode.ToString().ToLower(), mappingId, "label", "name", resourceName, resourceName, new List <string> {
            },
                                                               Common.GetDefaultExportLabels(),
                                                               Common.GetDefaultExportGroups(resourceId),
                                                               Common.GetDefaultExportItems(resourceId), Common.GetDefaultExportConverters()));
        }