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); }
public void SelectByIdTest() { Student1 itemTest = Student1TestData.CreateStudent11(); Student1 find = this.Service.SelectById(new Student1 { Id = itemTest.Id }); Assert.IsNotNull(find); Student1TestData.AssertAreEqual(itemTest, find); }
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); }
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); }
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); } }
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); }