private void SaveLoadConfigurationData(Role role, SerializerType serializer) { FileInfo _fileInfo = GetFileName(role, serializer, @"ConfigurationData{0}.{1}"); ConfigurationData _configuration = null; switch (role) { case Role.Producer: _configuration = ReferenceConfiguration.LoadProducer(); break; case Role.Consumer: _configuration = ReferenceConfiguration.LoadConsumer(); break; default: break; } ConfigurationDataFactoryIO.Save <ConfigurationData>(_configuration, serializer, _fileInfo, (x, y, z) => { Console.WriteLine(z); }); _fileInfo.Refresh(); Assert.IsTrue(_fileInfo.Exists); ConfigurationData _mirror = ConfigurationDataFactoryIO.Load <ConfigurationData>(serializer, _fileInfo, (x, y, z) => { Console.WriteLine(z); }, () => { }); ReferenceConfiguration.Compare(_configuration, _mirror); }
public void LoadSaveTestMethod() { LocalConfigurationData _configuration = ConfigurationDataFactoryIO.Load <LocalConfigurationData>(LocalConfigurationData.Loader, () => { }); Assert.IsNotNull(_configuration); Assert.AreEqual <int>(1, _configuration.OnLoadedCount); Assert.AreEqual <int>(0, _configuration.OnSavingCount); ConfigurationDataFactoryIO.Save <LocalConfigurationData>(_configuration, (x) => { Assert.AreEqual <int>(1, x.OnSavingCount); }); }