public void GetAllXmlTest() { string expected = @"<?xml version=""1.0"" encoding=""utf-8""?> <function controlid=""unittest""> <runDdsJob> <object>GLACCOUNT</object> <cloudDelivery>My Cloud Bucket</cloudDelivery> <jobType>change</jobType> <timeStamp>2002-09-24T06:00:00</timeStamp> <fileConfiguration> <delimiter>,</delimiter> <enclosure>""</enclosure> <includeHeaders>true</includeHeaders> <fileFormat>unix</fileFormat> <splitSize>10000</splitSize> <compress>false</compress> </fileConfiguration> </runDdsJob> </function>"; Stream stream = new MemoryStream(); XmlWriterSettings xmlSettings = new XmlWriterSettings(); xmlSettings.Encoding = Encoding.UTF8; xmlSettings.Indent = true; xmlSettings.IndentChars = " "; IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings); DdsJobCreate runJob = new DdsJobCreate("unittest"); runJob.ObjectName = "GLACCOUNT"; runJob.CloudDeliveryName = "My Cloud Bucket"; runJob.JobType = "change"; runJob.Timestamp = new DateTime(2002, 09, 24, 06, 0, 0); runJob.Delimiter = ","; runJob.Enclosure = "\""; runJob.IncludeHeaders = true; runJob.FileFormat = "unix"; runJob.SplitSize = 10000; runJob.Compressed = false; runJob.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()); }
public void GetXmlTest() { string expected = @"<?xml version=""1.0"" encoding=""utf-8""?> <function controlid=""unittest""> <runDdsJob> <object>GLACCOUNT</object> <cloudDelivery>My Cloud Bucket</cloudDelivery> <jobType>all</jobType> <fileConfiguration /> </runDdsJob> </function>"; Stream stream = new MemoryStream(); XmlWriterSettings xmlSettings = new XmlWriterSettings(); xmlSettings.Encoding = Encoding.UTF8; xmlSettings.Indent = true; xmlSettings.IndentChars = " "; IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings); DdsJobCreate runJob = new DdsJobCreate("unittest"); runJob.ObjectName = "GLACCOUNT"; runJob.CloudDeliveryName = "My Cloud Bucket"; runJob.JobType = "all"; runJob.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()); }