public T GetSerializedObject <T>(string type, string name) where T : class { byte[] resourceBytes = GetResource(type, name); //string xmlString = new string(Encoding.UTF8.GetChars(resourceBytes)); name = Path.GetFileNameWithoutExtension(name).ToLower(); return(_fileAssistant.Deserialize <T>(resourceBytes)); }
public void DeserializeJSONTest() { fileAssistant = new FileAssistant(); fileAssistant.SerializationType = "JSON"; var aElem = MockObjects.GetAnimationElement(); byte[] bytes = fileAssistant.Serialize(aElem); string xml = new string(Encoding.Unicode.GetChars(bytes)); if (bytes == null || bytes.Length == 0 && XDocument.Parse(xml) == null) { throw new Exception("Assert Fails"); } var aElem2 = fileAssistant.Deserialize <AnimationSingleElement>(bytes); if (aElem.Shape.TypeName != aElem2.Shape.TypeName) { throw new Exception("Assert Fails"); } }