public void SimpleUsage()
        {
            IApplicationContext ctx =
                new XmlApplicationContext("assembly://Spring.Data.Integration.Tests/Spring.Data/nativeAdoTests.xml");

            Assert.IsNotNull(ctx);
            ITestObjectDao dao = (ITestObjectDao)ctx["testObjectDao"];

            Assert.IsNotNull(dao);
            dao.Create("John", 45);
        }
Esempio n. 2
0
        public void CreateNative()
        {
            IApplicationContext ctx;
            string assemblyName = GetType().Assembly.GetName().Name;

            ctx = new XmlApplicationContext("assembly://" + assemblyName + "/Spring.Data.NHibernate/templateTests.xml");

            ITestObjectDao dao = (ITestObjectDao)ctx.GetObject("nativeNHTestObjectDao");

            TestObject toGeorge = new TestObject();

            toGeorge.Name = "George";
            toGeorge.Age  = 34;
            dao.Create(toGeorge);
        }
Esempio n. 3
0
 public void DoWork(TestObject testObject)
 {
     testObjectDao.Create(testObject);
 }
Esempio n. 4
0
	    private static void ExecuteDaoOperations(ITestObjectDao dao)
	    {
	        TestObject toGeorge = new TestObject();
	        toGeorge.Name = "George";
	        toGeorge.Age = 33;
	        dao.Create(toGeorge);
	        TestObject to = dao.FindByName("George");
	        Assert.IsNotNull(to, "FindByName for George should not return null");
	        Assert.AreEqual("George", to.Name);
	        Assert.AreEqual(33, to.Age);
    
	        to.Age=34;
	        dao.Update(to);
    
	        TestObject to2 = dao.FindByName("George");
	        Assert.AreEqual(34, to2.Age);
    
	        dao.Delete(to);
    
	        TestObject to3 = dao.FindByName("George");
	        Assert.IsNull(to3, "Should not have found TestObject with name George. TestObject = " + to.ToString()   );
	    }