Tests.TestContext.TestChainedInsertSimple C# (CSharp) Method

TestChainedInsertSimple() private method

private TestChainedInsertSimple ( ) : void
return void
        public void TestChainedInsertSimple()
        {
            using (Model.Context db = new Model.Context("mdbConnectionString"))
            {
                Author a = new Author();
                a.Username = "John";

                Post p = new Post();
                p.Content = "Test content";
                p.Author = a;

                int id = db.InsertOnSubmit<Post>(p);

                Assert.AreEqual(id, p.Id);
                Assert.AreEqual(p.Author, a);
                Assert.AreNotEqual(p.Author.Id, 0);

                db.DeleteOnSubmit<Post>(p, Context.CascadeStyle.Single); // force cascading delete

                db.SubmitChanges();
            }
        }