testabstractservice.cs

来自「本在线考试系统采用了面向对象的分析和设计」· CS 代码 · 共 46 行

CS
46
字号
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using ExaminationSystem.BLL.Domain;
using ExaminationSystem.BLL.Service;

namespace ExaminationSystem.Test.BLL
{
    [TestFixture]
    public class TestAbstractService
    {
        [Test]
        public void TestGetById()
        {
            Class cs =new ClassService().GetById(1);
            Console.Write(cs.Name);
            Assert.IsTrue(cs.Name.Length > 0);
        }
        [Test]
        public void TestSave()
        {
            Class cs = new Class();
            cs.Name = "testsave";
            new ClassService().Save(cs);
            Assert.IsTrue(cs.ID > 0);
        }
        [Test]
        public void TestGetByExample()
        {
            Class cs = new Class();
            cs.Name = "testsave";
            IList<Class> classes =new ClassService().GetByExample(cs);
            Assert.IsTrue(classes.Count == 2);
        }
        [Test]
        public void TestGetUniqueExample()
        {
            Class cs = new Class();
            cs.Name = "testsave1";
            Class classes =new ClassService().GetUniqueByExample(cs);
            Assert.IsTrue(classes.ID>1);
        }
    }
}

⌨️ 快捷键说明

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