⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testsubjectdao.cs

📁 本在线考试系统采用了面向对象的分析和设计
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using ExaminationSystem.BLL.Domain;
using ExaminationSystem.BLL.DataInterface;
using ExaminationSystem.DAL;

namespace ExaminationSystem.Test.DAL
{
    [TestFixture]
    public class TestSubjectDao:NHibernateTestCase
    {
        [Test]
        public void TestSave()
        {
            Subject subject = new Subject("数据结构");
            Assert.IsFalse(subject.ID > 0);

            IDaoFactory factory = new NHibernateDaoFactory();
            ISubjectDao dao = factory.GetSubjectDao();
            dao.Save(subject);

            Assert.IsTrue(subject.ID > 0);
        }
        [Test]
        public void TestChapterParent()
        {
            IDaoFactory factory = new NHibernateDaoFactory();
            IChapterDao dao = factory.GetChapterDao();
            Chapter parent = dao.GetById(3, false);
            Chapter child = dao.GetById(4, false);
            Assert.AreEqual(parent.Children[0], child);
            Assert.AreEqual(parent, child.Parent);
            Assert.AreEqual(null, parent.Parent);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -