public void MultipleMessages() { var sb = new StringBuilder(); var xmlWriter = XmlWriter.Create(sb, new XmlWriterSettings { OmitXmlDeclaration = true, ConformanceLevel = ConformanceLevel.Fragment }); var writer = new FudgeXmlStreamWriter(context, xmlWriter, "msg") { AutoFlushOnMessageEnd = true }; writer.StartMessage(); writer.WriteField("name", null, StringFieldType.Instance, "Bob"); writer.EndMessage(); writer.StartMessage(); writer.WriteField("hat", null, StringFieldType.Instance, "Stand"); writer.EndMessage(); Assert.Equal("<msg><name>Bob</name></msg><msg><hat>Stand</hat></msg>", sb.ToString()); }
public void SimpleTest() { var sb = new StringBuilder(); var xmlWriter = XmlWriter.Create(sb, new XmlWriterSettings { OmitXmlDeclaration = true }); var writer = new FudgeXmlStreamWriter(context, xmlWriter, "msg") { AutoFlushOnMessageEnd = true }; writer.StartMessage(); writer.WriteField("name", null, StringFieldType.Instance, "Bob"); writer.EndMessage(); Assert.Equal("<msg><name>Bob</name></msg>", sb.ToString()); }