public void SuccessTest() { 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); Control control = response.Control; Assert.Equal("testsenderid", control.SenderId); Assert.Equal("ControlIdHere", control.ControlId); Assert.Equal("false", control.UniqueId); Assert.Equal("3.0", control.DtdVersion); }
public void MissingStatusElementTest() { string xml = @"<?xml version=""1.0"" encoding=""utf-8""?> <response> <control /> </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 MissingSenderIdElementTest() { 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); }