internal static void BuildCategoryTypes(dynamic builder, Func <dynamic> createCategoryType, Func <dynamic> createCategory, List <CategoryType> categoryTypes)
        {
            foreach (var catType in categoryTypes)
            {
                var categoryTypeBuilder = createCategoryType();

                var exportType = OrchestrateHelper.MapCategoryExportType(catType.CategoryExportType.ToString());
                categoryTypeBuilder
                .SetExternalId(catType.ExternalId)
                .SetCategoryTypeName(catType.Name)
                .SetExportType(exportType)
                .SetIsFoodType(catType.IsFood);

                foreach (var category in catType.MainCategories)
                {
                    var mainCategoryBuilder = createCategory();
                    mainCategoryBuilder
                    .SetExternalId(category.ExternalId)
                    .SetCategoryName(category.Name)
                    .SetParentExternalId(category.ParentExternalId);

                    #region build nested items

                    var parentItem    = category;
                    var parentBuilder = mainCategoryBuilder;
                    while (parentItem.SubCategories != null)
                    {
                        var nestedItem    = parentItem.SubCategories.First();
                        var nestedBuilder = createCategory();
                        nestedBuilder
                        .SetExternalId(nestedItem.ExternalId)
                        .SetCategoryName(nestedItem.Name)
                        .SetParentExternalId(nestedItem.ParentExternalId);
                        parentBuilder.AddSubCategories(nestedBuilder);
                        parentItem    = nestedItem;
                        parentBuilder = nestedBuilder;
                    }

                    #endregion

                    categoryTypeBuilder.AddMainCategories(mainCategoryBuilder);
                }
                builder.AddCategoryTypes(categoryTypeBuilder);
            }
        }
        public void MapCategoryExportType_should_return_None_for_notExisting_values(string value, CategoryExportType expected)
        {
            var actual = OrchestrateHelper.MapCategoryExportType(value);

            Assert.Equal(expected, actual);
        }
        public void MapCategoryExportType_should_parse_stringInt_toEnum(string value, CategoryExportType expected)
        {
            var actual = OrchestrateHelper.MapCategoryExportType(value);

            Assert.Equal(expected, actual);
        }