public void Is_Serialized() { var serializableItem = _homeItem.Object; var directory = new DirectoryInfo(_pathProvider.GetFolderPath(serializableItem, TempFolder)); directory.Create(); var file = new FileInfo(_pathProvider.GetPath(serializableItem, TempFolder)); try { //arrange file.Create().Close(); //act var isSerialized = _serializationProvider.IsSerialized(serializableItem, _definitionsProviderObject.GetSerializationDefinitions(null).First()); //assert Assert.IsTrue(isSerialized); } finally { if (directory.Exists) { directory.Delete(true); } } }
public virtual void Serialize(ISerializableItem item) { // foreach serialization definition var serializationDefinitions = _definitionsProvider. GetSerializationDefinitions(item.Database); foreach (var serializationDefinition in serializationDefinitions) { //see if item needs to be serialized if (!serializationDefinition.Evaluate(item)) { continue; } // get the right folder var path = _pathProvider.GetPath(item, serializationDefinition.Path); //serialize it item.Dump(path); } }