Exemplo n.º 1
0
        public void CheckCascadeWithCards()
        {
            Lesson lesson = new Lesson { Title = "The title" };
            Card card = new Card { Title = "Card title" };
            lesson.AddCard(card);

            SaveOrUpdate(lesson);

            using (this.Session.BeginTransaction()) {
                var dbLessons = Retrieve<Lesson>();
                Assert.AreEqual(1, dbLessons[0].Cards.Count);
                Assert.AreEqual(card.Title, dbLessons[0].Cards[0].Title);
            }
        }
Exemplo n.º 2
0
        public void IntegrationWithCards()
        {
            Lesson lesson = new Lesson();
            Card card = new Card { Title = "Card title" };
            lesson.AddCard(card);

            Assert.AreEqual(1, lesson.Cards.Count);
            Assert.AreSame(card, lesson.Cards[0]);
            Assert.AreSame(lesson, card.Lesson);
        }