public async Task TestReturnEmptyXml() { XmlFileContext<SampleContext> xmlFileCtx = new XmlFileContext<SampleContext>(this.GetType()); using (SampleContext emptyContext = xmlFileCtx.Empty()) { Author aut1 = new Author(); aut1.FirstName = "testname"; emptyContext.Authors.Attach(aut1); string fromFile = await emptyContext.AsXmlAsync(DbContextConverterOptions.DEFAULT.WithNullValues()); dynamic obj = fromFile.XmlToDynamic(); ((string)obj.AUTHOR[0].AUT_FIRSTNAME).ShouldBe("testname"); } }
private SampleContext GetSimpleTestContext() { SampleContext simpleContext = new XmlFileContext<SampleContext>(this.GetType()).Empty(); Author cedric = new Author() { FirstName = "Cedric", LastName = "Dumont" }; simpleContext.Authors.Add(cedric); simpleContext.SaveChanges(); return simpleContext; }