I would like to suggest several refactoring s around the Nop.Services/ExportImport folder.

Currently, this folder consists of 2 main files (ImportManager and ExportManager) which, due to their size (2000 lines each), large number of dependencies, some lack of use of abstractions and high cyclomatic complexity, is difficult to write unit tests to confirm their functionality.

I have a number of refactoring s in mind, but all that I would like to propose at this stage is an improved organisation in the ExportImport namespace.

This is the current folder structure:




And this is the suggested folder structure:




Note: I feel that improving the organisation of the ExportImport folder would allow us to later separate out some of the methods in ImportManager and ExportManager into their new corresponding folders.


These are steps I suggest:

1. Create the following new folders:
/ExportImport/Export
/ExportImport/Import

2. Move the following files into /ExportImport/Export and change the corresponding namespaces:
ExportManager.cs
ExportProductAttribute.cs
ExportSpecificationAttribute.cs
Extensions.cs
IExportManager.cs

3. Move the following files into /ExportImport/Import and change the corresponding namespaces:
IImportManager.cs
IImportManager.cs
ImportProductMetadata.cs
TypeOfExportedAttribute.cs (even though this has Export in the name it actually relates to imports)

4. Move /ExportImport/Help/ files up a level to /ExportImport/ and change the corresponding namespaces:
PropertyByName.cs
PropertyManager.cs

Note: The /Help folder is a poorly named folder and as these files both correspond to Imports and Exports they should sit above these folders.

5. Remove the empty /ExportImport/Help folder.

6. Rename the following classes:

/Import/ImportProductMetadata.cs rename to /Import/ProductMetadata.cs (we can remove Import from the name as we are now in the folder context of 'Import')
/Import/TypeOfExportedAttribute.cs rename to /Import/AttributeType.cs (this file has nothing to do with exports)