public void ShouldBeAbleToConvertEmptyList() { IList<SampleDataClass> list = new List<SampleDataClass>(); XDocument xDoc = list.ConvertToXml<SampleDataClass>(); var expected = string.Format("<SampleDataClassCollection />"); xDoc.ToString().ShouldEqualWithDiff(expected); }
public void ShouldBeAbleToConvertLists() { IList<SampleDataClass> list = new List<SampleDataClass>() { new SampleDataClass(){ Id = 1, Description = "foo", }, new SampleDataClass(){ Id = 2, Description = "foo2", } }; XDocument xDoc = list.ConvertToXml<SampleDataClass>(); var expected = string.Format("<SampleDataClassCollection>\r\n " + "<SampleDataClass>\r\n " + "<Id>1</Id>\r\n " + "<Description>foo</Description>\r\n " + "</SampleDataClass>\r\n " + "<SampleDataClass>\r\n " + "<Id>2</Id>\r\n " + "<Description>foo2</Description>\r\n " + "</SampleDataClass>\r\n" + "</SampleDataClassCollection>"); xDoc.ToString().ShouldEqualWithDiff(expected); }
private void saveJob() { _jobItems.ConvertToXml().Save(_JobFileName); }