public void TestHandleMessage() { config.SetPropertyFieldForTests("MaskCredentials", true); listener = new MockTraceListener(config); XmlDocument xOutgoing = new XmlDocument(); xOutgoing.LoadXml(Resources.XmlRequest); listener.HandleMessage(xOutgoing, adsClient, SoapMessageDirection.OUT); Assert.AreEqual(xOutgoing.OuterXml, ContextStore.GetValue("SoapRequest")); XmlDocument xIncoming = new XmlDocument(); xIncoming.LoadXml(Resources.XmlResponse); listener.HandleMessage(xIncoming, adsClient, SoapMessageDirection.IN); Assert.AreEqual(xIncoming.OuterXml, ContextStore.GetValue("SoapResponse")); Assert.AreEqual(Resources.SoapLog.Replace("\r\n", "\n"), ((string) ContextStore.GetValue("FormattedSoapLog")).Replace("\r\n", "\n")); Assert.AreEqual(Resources.ResponseLog.Replace("\r\n", "\n"), ((string) ContextStore.GetValue("FormattedRequestLog")).Replace("\r\n", "\n")); }
public void TestHandleMessageNoClient() { config.SetPropertyFieldForTests("LogToFile", true); config.SetPropertyFieldForTests("MaskCredentials", true); listener = new MockTraceListener(config); listener.Writer = writer; XmlDocument xOutgoing = new XmlDocument(); xOutgoing.LoadXml(Resources.XmlRequest); listener.HandleMessage(xOutgoing, null, SoapMessageDirection.OUT); Assert.AreEqual(xOutgoing.OuterXml, ContextStore.GetValue("SoapRequest")); XmlDocument xIncoming = new XmlDocument(); xIncoming.LoadXml(Resources.XmlResponse); listener.HandleMessage(xIncoming, null, SoapMessageDirection.IN); Assert.AreEqual(xIncoming.OuterXml, ContextStore.GetValue("SoapResponse")); Assert.IsNull(writer.SoapLog); Assert.IsNull(writer.RequestLog); }