コード例 #1
0
        public void SelectByIdTest()
        {
            Student1 item = Student1TestData.CreateStudent11();
            Student1 find = this.Dao.SelectById(this.Context, item);

            Assert.AreEqual(item.Id, find.Id);
            Student1TestData.AssertAreEqual(item, find);
        }
コード例 #2
0
        public void DeleteTest()
        {
            Student1 itemTest     = Student1TestData.CreateStudent12();
            int      affectedRows = this.Service.Delete(itemTest, true);

            List <Student1> items = this.Service.SelectAll();

            Assert.AreEqual(items.Count, Student1TestData.Student1Count - 1);
            Assert.AreEqual(-1, affectedRows);
        }
コード例 #3
0
        public void SelectByIdTest()
        {
            Student1 itemTest = Student1TestData.CreateStudent11();

            Student1 find = this.Service.SelectById(new Student1 {
                Id = itemTest.Id
            });

            Assert.IsNotNull(find);

            Student1TestData.AssertAreEqual(itemTest, find);
        }
コード例 #4
0
        public void UpdateTest()
        {
            Student1 item         = Student1TestData.CreateStudent11();
            Student1 beforeUpdate = this.Dao.SelectById(this.Context, item);

            Assert.IsNotNull(beforeUpdate);
            beforeUpdate.StudentNUM = 0;

            this.Dao.Update(this.Context, beforeUpdate);

            Student1 afterUpdate = this.Dao.SelectById(this.Context, beforeUpdate);

            Student1TestData.AssertAreEqual(beforeUpdate, afterUpdate);
        }
コード例 #5
0
        public void UpdateTest()
        {
            Student1 itemTest = Student1TestData.CreateStudent11();

            Student1 beforeUpdate = this.Service.SelectById(new Student1 {
                Id = itemTest.Id
            });

            beforeUpdate.StudentNUM = 0;
            this.Service.Update(beforeUpdate, true);

            Student1 afterUpdate = this.Service.SelectById(new Student1 {
                Id = itemTest.Id
            });

            Student1TestData.AssertAreEqual(beforeUpdate, afterUpdate);
        }
コード例 #6
0
        public void SelectByTest()
        {
            Student1 itemTest = Student1TestData.CreateStudent11();

            List <Student1> find = this.Service.SelectBy(new Student1 {
                StudentNUM = itemTest.StudentNUM
            }, new List <string> {
                "StudentNUM"
            });

            Assert.IsNotNull(find);

            foreach (Student1 item in find)
            {
                Assert.AreEqual(itemTest.StudentNUM, item.StudentNUM);
            }
        }
コード例 #7
0
        public void DeleteTest()
        {
            Student1 item         = Student1TestData.CreateStudent11();
            Student1 beforedelete = this.Dao.SelectById(this.Context, item);

            Assert.IsNotNull(beforedelete);

            int affectedRows = this.Dao.Delete(this.Context, beforedelete);

            Assert.AreEqual(1, affectedRows);

            Student1 afterDelete = this.Dao.SelectById(this.Context, beforedelete);

            Assert.IsNull(afterDelete);

            List <Student1> items = this.Dao.SelectAll(this.Context);

            Assert.AreEqual(Student1TestData.Student1Count - 1, items.Count);
        }
コード例 #8
0
        public void InsertTest()
        {
            Student1 item = new Student1
            {
                StudentNUM  = 0,
                Description = string.Empty,
                Name        = string.Empty,
                StudentName = string.Empty,
            };
            int affectedRows = this.Dao.Insert(this.Context, item);

            Assert.AreEqual(1, affectedRows);

            Student1 find = this.Dao.SelectById(this.Context, item);

            Student1TestData.AssertAreEqual(item, find);

            List <Student1> items = this.Dao.SelectAll(this.Context);

            Assert.AreEqual(Student1TestData.Student1Count + 1, items.Count);
        }
コード例 #9
0
 public Student1DaoTest() : base(Student1TestData.CreateStudent1())
 {
 }