📄 testsubjectdao.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 + -