Beispiel #1
0
        public void AssignUnmanagedListToListProperty()
        {
            SngTblEmployee e = (SngTblEmployee)m_Context2.CreateObject(typeof(SngTblEmployee));

            //this should fail
            e.WorkFolders = new ArrayList();
        }
Beispiel #2
0
        public void TestCreateAndFetchEmployeeAndWorkFolder()
        {
            SngTblEmployee   e  = (SngTblEmployee)m_Context.CreateObject(typeof(SngTblEmployee));
            SngTblWorkFolder wf = (SngTblWorkFolder)m_Context.CreateObject(typeof(SngTblWorkFolder));

            e.FirstName      = "Mats";
            e.LastName       = "Helander";
            e.Salary         = 2000;
            e.EmploymentDate = DateTime.Now;
            wf.Name          = "My First Folder";
            wf.Person        = e;
            wf.Employee      = e;
            wf.WorkType      = "Boring";        //ROGER: c'mon , be positive now
            m_Context.Commit();
            m_Context2 = GetContext();
            m_Context2.ExecutingSql += new ExecutingSqlEventHandler(this.m_Context2_ExecutingSql);

            SngTblEmployee e2 = (SngTblEmployee)m_Context2.GetObject(e.Id, typeof(SngTblEmployee));

            Assert.AreEqual("Mats", e2.FirstName);
            Assert.AreEqual("Helander", e2.LastName);
            Assert.AreEqual(2000, e2.Salary);
            SngTblWorkFolder wf2 = (SngTblWorkFolder)m_Context2.GetObject(wf.Id, typeof(SngTblWorkFolder));

            Assert.AreEqual("Boring", wf2.WorkType);
            Assert.AreEqual("Mats", wf2.Employee.FirstName);
            m_Context2.Dispose();
        }
Beispiel #3
0
        public void AssignManagedObjectOfOtherContextToProperty()
        {
            SngTblWorkFolder wf = (SngTblWorkFolder)m_Context.CreateObject(typeof(SngTblWorkFolder));
            SngTblEmployee   e  = (SngTblEmployee)m_Context2.CreateObject(typeof(SngTblEmployee));

            //this should fail
            wf.Employee = e;
        }
Beispiel #4
0
        public void TestCreateEmployee()
        {
            SngTblEmployee e = (SngTblEmployee)m_Context.CreateObject(typeof(SngTblEmployee));

            e.FirstName      = "Mats";
            e.LastName       = "Helander";
            e.Salary         = 2000;
            e.EmploymentDate = DateTime.Now;
            m_Context.Commit();
        }
Beispiel #5
0
        public void TestCreateEmployeeAndFolder()
        {
            SngTblEmployee e = (SngTblEmployee)m_Context.CreateObject(typeof(SngTblEmployee));
            SngTblFolder   f = (SngTblFolder)m_Context.CreateObject(typeof(SngTblFolder));

            e.FirstName      = "Mats";
            e.LastName       = "Helander";
            e.Salary         = 2000;
            e.EmploymentDate = DateTime.Now;
            f.Name           = "My First Folder";
            f.Person         = e;
            m_Context.Commit();
        }
Beispiel #6
0
        public void TestCreateAndFetchEmployee()
        {
            SngTblEmployee e = (SngTblEmployee)m_Context.CreateObject(typeof(SngTblEmployee));

            e.FirstName      = "Mats";
            e.LastName       = "Helander";
            e.Salary         = 2000;
            e.EmploymentDate = DateTime.Now;
            m_Context.Commit();
            m_Context2 = GetContext();
            m_Context2.ExecutingSql += new ExecutingSqlEventHandler(this.m_Context2_ExecutingSql);

            SngTblEmployee e2 = (SngTblEmployee)m_Context2.GetObject(e.Id, typeof(SngTblEmployee));

            Assert.AreEqual("Mats", e2.FirstName);
            Assert.AreEqual("Helander", e2.LastName);
            Assert.AreEqual(2000, e2.Salary);
            m_Context2.Dispose();
        }