public void Required_RequiredNew_InsertNewStudent2() { Assert.IsNotNull(System.Transactions.Transaction.Current); IEntytiManager em = EJBContainer.Instance.EntityManager; RequiredNew_InsertNewStudent(); Student s = new Student(); s.Id = 3; s.FirstName = "Vardenis3"; s.LastName = "Pavardenis3"; s.BirthDay = new DateTime(1991, 01, 01); em.Persist(s); Assert.IsNotNull(System.Transactions.Transaction.Current); UniversityContext uc = new UniversityContext(); Assert.IsNull(uc.Students.SingleOrDefault(e => e.Id == 3 && e.FirstName == "Vardenis3" && e.LastName == "Pavardenis3" && e.BirthDay == new DateTime(1991, 01, 01))); Assert.IsNotNull(uc.Students.SingleOrDefault(e => e.Id == 2 && e.FirstName == "Vardenis" && e.LastName == "Pavardenis" && e.BirthDay == new DateTime(1990, 01, 01))); }
public void NotSupports_InsertNewStudent() { IEntytiManager em = EJBContainer.Instance.EntityManager; Student s = new Student(); s.Id = 2; s.FirstName = "Vardenis2"; s.LastName = "Pavardenis2"; s.BirthDay = new DateTime(1990, 01, 02); em.Persist(s); Assert.IsNull(System.Transactions.Transaction.Current); }