public void ControlBlockFailureTest() { string xml = @"<?xml version=""1.0"" encoding=""utf-8""?> <response> <control> <status>failure</status> <senderid>testsenderid</senderid> <controlid>ControlIdHere</controlid> <uniqueid>false</uniqueid> <dtdversion>3.0</dtdversion> </control> <errormessage> <error> <errorno>XL03000006</errorno> <description></description> <description2>test is not a valid transport policy.</description2> <correction></correction> </error> </errormessage> </response>"; Stream stream = new MemoryStream(); StreamWriter streamWriter = new StreamWriter(stream); streamWriter.Write(xml); streamWriter.Flush(); stream.Position = 0; MockAbstractResponse response = new MockAbstractResponse(stream); }
public void GetControlBlockTest() { string xml = @"<?xml version=""1.0"" encoding=""utf-8""?> <response> <control> <status>success</status> <senderid>testsenderid</senderid> <controlid>ControlIdHere</controlid> <uniqueid>false</uniqueid> <dtdversion>3.0</dtdversion> </control> </response>"; Stream stream = new MemoryStream(); StreamWriter streamWriter = new StreamWriter(stream); streamWriter.Write(xml); streamWriter.Flush(); stream.Position = 0; MockAbstractResponse response = new MockAbstractResponse(stream); Assert.IsInstanceOfType(response.Control, typeof(Control)); }
public void InvalidXmlResponseTest() { string xml = @"<bad></xml>"; Stream stream = new MemoryStream(); StreamWriter streamWriter = new StreamWriter(stream); streamWriter.Write(xml); streamWriter.Flush(); stream.Position = 0; MockAbstractResponse response = new MockAbstractResponse(stream); }
public void MissingControlBlockTest() { string xml = @"<?xml version=""1.0"" encoding=""utf-8""?> <response> <nocontrolblock/> </response>"; Stream stream = new MemoryStream(); StreamWriter streamWriter = new StreamWriter(stream); streamWriter.Write(xml); streamWriter.Flush(); stream.Position = 0; MockAbstractResponse response = new MockAbstractResponse(stream); }