コード例 #1
0
        public void AddEvent()
        {
            using (LinqLibraryDataContext db = new LinqLibraryDataContext(m_ConnectionString))
            {
                Event newEvent = new Event();
                newEvent.book         = db.GetBook("The Warded Man").book_ID;
                newEvent.reader       = db.GetReader("Eliza", "Lech").reader_ID;
                newEvent.Event_date   = DateTime.Now;
                newEvent.is_returning = false;

                db.AddEvent(newEvent);

                Event gotEvent = db.GetEvent(newEvent.event_ID);
                Assert.AreEqual(newEvent.book, gotEvent.book);
                Assert.AreEqual(newEvent.reader, gotEvent.reader);
                Assert.AreEqual(newEvent.Event_date, gotEvent.Event_date);
            }
        }