public void GetXmlTest() { string expected = @"<?xml version=""1.0"" encoding=""utf-8""?> <function controlid=""unittest""> <consolidate> <bookid>USD Books</bookid> <reportingperiodname>Month Ended June 2016</reportingperiodname> </consolidate> </function>"; ConsolidationCreate record = new ConsolidationCreate("unittest") { ReportingBookId = "USD Books", ReportingPeriodName = "Month Ended June 2016" }; this.CompareXml(expected, record); }
public void GetAllXmlTest() { string expected = @"<?xml version=""1.0"" encoding=""utf-8""?> <function controlid=""unittest""> <consolidate> <bookid>USD Books</bookid> <reportingperiodname>Month Ended June 2016</reportingperiodname> <offline>true</offline> <updatesucceedingperiods>false</updatesucceedingperiods> <changesonly>true</changesonly> <email>[email protected]</email> <entities> <csnentity> <entityid>VT</entityid> <bsrate>0.0000483500</bsrate> <warate>0.0000485851</warate> </csnentity> </entities> </consolidate> </function>"; ConsolidationCreate record = new ConsolidationCreate("unittest") { ReportingBookId = "USD Books", ReportingPeriodName = "Month Ended June 2016", ProcessOffline = true, ChangesOnly = true, UpdateSucceedingPeriods = false, NotificationEmail = "*****@*****.**", }; ConsolidationEntity entity = new ConsolidationEntity { EntityId = "VT", EndingSpotRate = 0.0000483500M, WeightedAverageRate = 0.0000485851M }; record.Entities.Add(entity); this.CompareXml(expected, record); }
public void GetXmlTest() { string expected = @"<?xml version=""1.0"" encoding=""utf-8""?> <function controlid=""unittest""> <consolidate> <bookid>USD Books</bookid> <reportingperiodname>Month Ended June 2016</reportingperiodname> </consolidate> </function>"; Stream stream = new MemoryStream(); XmlWriterSettings xmlSettings = new XmlWriterSettings(); xmlSettings.Encoding = Encoding.UTF8; xmlSettings.Indent = true; xmlSettings.IndentChars = " "; IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings); ConsolidationCreate rate = new ConsolidationCreate("unittest"); rate.ReportingBookId = "USD Books"; rate.ReportingPeriodName = "Month Ended June 2016"; rate.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 GetAllXmlTest() { string expected = @"<?xml version=""1.0"" encoding=""utf-8""?> <function controlid=""unittest""> <consolidate> <bookid>USD Books</bookid> <reportingperiodname>Month Ended June 2016</reportingperiodname> <offline>true</offline> <updatesucceedingperiods>false</updatesucceedingperiods> <changesonly>true</changesonly> <email>[email protected]</email> <entities> <csnentity> <entityid>VT</entityid> <bsrate>0.0000483500</bsrate> <warate>0.0000485851</warate> </csnentity> </entities> </consolidate> </function>"; Stream stream = new MemoryStream(); XmlWriterSettings xmlSettings = new XmlWriterSettings(); xmlSettings.Encoding = Encoding.UTF8; xmlSettings.Indent = true; xmlSettings.IndentChars = " "; IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings); ConsolidationCreate rate = new ConsolidationCreate("unittest") { ReportingBookId = "USD Books", ReportingPeriodName = "Month Ended June 2016", ProcessOffline = true, ChangesOnly = true, UpdateSucceedingPeriods = false, NotificationEmail = "*****@*****.**", }; ConsolidationEntity entity = new ConsolidationEntity(); entity.EntityId = "VT"; entity.EndingSpotRate = 0.0000483500M; entity.WeightedAverageRate = 0.0000485851M; rate.Entities.Add(entity); rate.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()); }