private static void AssertBook(PhysicalBook book) { Test.AssertBook(book); DataPortal.Direct <PhysicalBook>((conn) => { var data = conn.QuerySingle("select * from PhysicalBook where id=@id", new { Id = book.Id }); Assert.AreEqual(data.Subject, book.Subject); }); Assert.AreEqual("物理书的内容", book.Content); }
private PhysicalBook InsertBook() { PhysicalBook book = new PhysicalBook(Guid.NewGuid()) { Subject = "光学", PhysicalCover = new BookCover("物理书的封面", "2", new Author("物理设计师", Sex.Female, Person.Empty), Array.Empty <Author>()), TeacherCover = new PersonCover("物理老师", "1", Author.Empty, Array.Empty <Author>(), "胡老师") }; book.ProfessorCover = book.TeacherCover; var o = book.Owner; var id = 1; book.Owner = Repository.FindRemoteRoot <User>(id); AssertOwner(book.Owner); Test.FillBook(book); return(book); }