public void NoViewTest() { Stream stream = new MemoryStream(); XmlWriterSettings xmlSettings = new XmlWriterSettings(); xmlSettings.Encoding = Encoding.UTF8; xmlSettings.Indent = true; xmlSettings.IndentChars = " "; IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings); ReadView readView = new ReadView("unittest"); //readView.ViewName = "TestBill Date Runtime"; readView.WriteXml(ref xml); }
public void ParamOverridesTest() { string expected = @"<?xml version=""1.0"" encoding=""utf-8""?> <function controlid=""unittest""> <readView> <view>TestBill Date Runtime</view> <pagesize>10</pagesize> <returnFormat>xml</returnFormat> </readView> </function>"; Stream stream = new MemoryStream(); XmlWriterSettings xmlSettings = new XmlWriterSettings(); xmlSettings.Encoding = Encoding.UTF8; xmlSettings.Indent = true; xmlSettings.IndentChars = " "; IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings); ReadView readView = new ReadView("unittest"); readView.ViewName = "TestBill Date Runtime"; readView.PageSize = 10; readView.ReturnFormat = "xml"; readView.WriteXml(ref xml); xml.Flush(); stream.Position = 0; StreamReader reader = new StreamReader(stream); Diff xmlDiff = DiffBuilder.Compare(expected).WithTest(reader.ReadToEnd()) .WithDifferenceEvaluator(DifferenceEvaluators.Default) .Build(); Assert.IsFalse(xmlDiff.HasDifferences(), xmlDiff.ToString()); }