public void ReaderNextEntityWithRootEntityAttribute() { MemoryStream input = new MemoryStream(Encoding.UTF8.GetBytes(Properties.Resources.ResponseWithBlob)); XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(input, XmlDictionaryReaderQuotas.Max); ResponseParser <M> parser = new ResponseParser <M>(); M mapStudioFile = parser.ReadNextEntity(reader); }
public void ReaderNextEntityWithRootEntityWrongName() { MemoryStream input = new MemoryStream(Encoding.UTF8.GetBytes(Properties.Resources.ResponseWithBlob)); XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(input, XmlDictionaryReaderQuotas.Max); ResponseParser <Z> parser = new ResponseParser <Z>(); var ex = Assert.Throws <InvalidOperationException>(() => parser.ReadNextEntity(reader)); Assert.AreEqual("Don't know how to handle element MapStudioFiles", ex.Message); }
public void ReadNextEntityBlob() { MemoryStream input = new MemoryStream(Encoding.UTF8.GetBytes(Properties.Resources.ResponseWithBlob)); XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(input, XmlDictionaryReaderQuotas.Max); ResponseParser <MapStudioFiles> parser = new ResponseParser <MapStudioFiles>(); MapStudioFiles mapStudioFile = parser.ReadNextEntity(reader); Assert.AreEqual(3, mapStudioFile.SomeStringArray.Length); Assert.AreEqual("item 1", mapStudioFile.SomeStringArray[0]); Assert.AreEqual("item 2", mapStudioFile.SomeStringArray[1]); Assert.AreEqual("last item", mapStudioFile.SomeStringArray[2]); }
public void ReadNextEntityNullReader() { ResponseParser <object> parser = new ResponseParser <object>(); parser.ReadNextEntity(null); }