public void TestInit() { EJBContainer c = EJBContainer.Instance; c.Configuration.SetDBContextCreationFuncForEntityManager(() => new UniversityContext()); c.Init(); }
public void EntityManagerGotFromEJBContainer_NoDefinedDataContext_ShouldThrowExceptionOnContainerInitMethod() { EJBContainer c = EJBContainer.Instance; c.Configuration.SetDBContextCreationFuncForEntityManager(null); c.Init(); }
public void TestInit() { Trace.WriteLine("Executing EntityManagerTests::TestInit()"); EJBContainer c = EJBContainer.Instance; c.Configuration.SetDBContextCreationFuncForEntityManager(() => new UniversityContext()); c.Init(); using (UniversityContext context = new UniversityContext()) { foreach (Student s in context.Students) { context.Students.Remove(s); } context.SaveChanges(); } using (UniversityContext context = new UniversityContext()) { Student s = new Student() { Id = 1, BirthDay = new DateTime(1980, 05, 05), FirstName = "Petras", LastName = "Petraitis" }; context.Students.Add(s); context.SaveChanges(); } }
public void GetEntityManager_ReturnNotNull() { EJBContainer c = EJBContainer.Instance; c.Configuration.SetFullAssebliesNamesForSessionBeans(new[] { "abc" }); c.Init(); Assert.IsNotNull(c.EntityManager); }
public static void TestClassInit(TestContext textContext) { Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); Trace.WriteLine("Executing EntityManagerTests::TestClassInit()"); Database.SetInitializer(new UniversityInitializer()); EJBContainer c = EJBContainer.Instance; c.Configuration.SetDBContextCreationFuncForEntityManager(() => new UniversityContext()); c.Init(); //using (UniversityContext context = new UniversityContext()) //{ // foreach (Student s in context.Students) // { // context.Students.Remove(s); // } // context.SaveChanges(); //} }
public void TestsInit() { Trace.WriteLine("Executing ContainerManagedTransactions::TestsInit(..)"); EJBContainer c = EJBContainer.Instance; c.Configuration.SetDBContextCreationFuncForEntityManager(() => new UniversityContext()); c.Init(); using (UniversityContext context = new UniversityContext()) { foreach (Student s in context.Students) { context.Students.Remove(s); } foreach (Log l in context.Logs) { context.Logs.Remove(l); } context.SaveChanges(); } }
public static void TestClassInit(TestContext textContext) { Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); EJBContainer c = EJBContainer.Instance; c.Configuration.SetDBContextCreationFuncForEntityManager(() => new UniversityContext()); c.Init(); using (UniversityContext context = new UniversityContext()) { foreach (Student s in context.Students) { context.Students.Remove(s); } foreach (Log l in context.Logs) { context.Logs.Remove(l); } context.SaveChanges(); } }