Example #1
0
        public void GetCustomerByIdTest()
        {
            _sample = new NHibernateSample.Data.NHibernateSample(typeof(Customer));
            var tempCutomer = new Customer { id=16,name = "永京" };
            _sample.CreateCustomer(tempCutomer);
            Customer customer = _sample.GetCustomerById(1);

            int customerId = customer.id;
            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(1, customerId);
        }
Example #2
0
 public void insertCustomer()
 {
     _sample = new NHibernateSample.Data.NHibernateSample(typeof(Customer));
     var tempCutomer = new Customer { id = 36, name = "永京", password = "******" };
     _sample.CreateCustomer(tempCutomer);
     Customer cm = _sample.GetCustomerById(36);
     string name = cm.name;
     string password = cm.password;
     Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual("永京", name);
     Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual("minjie", password);
 }
Example #3
0
        public void GetCustomerByIdTest()
        {
            _sample = new NHibernateSample.Data.NHibernateSample(typeof(Customer));

            //this will be delete at the deleteC method in the end
            //so that it will success the next time run this whole TEST
            var tempCutomer = new Customer { id=16,name = "永京" };
            _sample.CreateCustomer(tempCutomer);

            Customer customer = _sample.GetCustomerById(1);
            int customerId = customer.id;
            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(1, customerId);
        }
Example #4
0
 public virtual void changerole(Customer cm ,string brole)
 {
     cm.role=brole;
     Session.Save(cm);
     Session.Flush();
 }
Example #5
0
 public virtual void changepassword(Customer cm  ,string bpass)
 {
     cm.password = bpass;
     Session.Save(cm);
     Session.Flush();
 }
Example #6
0
 public void changename(Customer cm, string bname)
 {
     cm.name = bname;
     Session.Save(cm);
     Session.Flush();
 }
Example #7
0
 public void delete(Customer cm)
 {
     Session.Delete(cm);
     Session.Flush();
 }
Example #8
0
 public void CreateCustomer(Customer customer)
 {
     Session.Save(customer);
     Session.Flush();
 }