internal static void Save <ConfigurationDataType>(ConfigurationDataType configuration, SerializerType serializer, FileInfo configurationFile, Action <TraceEventType, int, string> trace)
            where ConfigurationDataType : class, IConfigurationDataFactory, new()
        {
            configuration?.OnSaving();
            Action <FileInfo, ConfigurationDataType, Action <TraceEventType, int, string> > _saver = null;

            if (serializer == SerializerType.Xml)
            {
                _saver = (conf, file, tracer) => XmlDataContractSerializers.Save <ConfigurationDataType>(conf, file, tracer);
            }
            else
            {
                _saver = (conf, file, tracer) => JSONDataContractSerializers.Save <ConfigurationDataType>(conf, file, tracer);
            }
            _saver(configurationFile, configuration, (x, y, z) => trace?.Invoke(x, y, z));
        }
        public void JSONSerializerTestMethod1()
        {
            // Create a new instance of the Person class and serialize it to an XML file.
            CSharpSelectedTypesEncoding _p1 = new CSharpSelectedTypesEncoding();
            string _fileName = "DataContractExample.json";

            JSONDataContractSerializers.Save <CSharpSelectedTypesEncoding>(new FileInfo(_fileName), _p1, (x, y, z) => Assert.AreEqual(System.Diagnostics.TraceEventType.Verbose, x));
            FileInfo _newFile = new FileInfo(_fileName);

            Assert.IsTrue(_newFile.Exists);
            CSharpSelectedTypesEncoding _p2 = JSONDataContractSerializers.Load <CSharpSelectedTypesEncoding>
                                                  (new FileInfo(_fileName), (x, y, z) => Assert.AreEqual <System.Diagnostics.TraceEventType>(System.Diagnostics.TraceEventType.Verbose, x));

            Assert.IsNotNull(_p2);
            _p1.AreEqual(_p2);
        }