public void Should_return_valid_type()
        {
            var parameters = new System.Collections.Specialized.NameValueCollection();
            var testObject = new TestObject();
            var tdef = new TestTypeDefinition(testObject)
            {            
               Parameters = parameters                
            }; 
           
            IObjectCreator<TestObject> creator = new ObjectCreator<TestObject>();

            var result = creator.Create(tdef);

            result.ShouldBeType(testObject.GetType());          
        }
Example #2
0
        public void TestTransaction1()
        {
            ISqlMapper    sqlMapper     = new DomSqlMapBuilder().Configure("IBatisNet.config");
            TestObjectDao testObjectDao = new TestObjectDao(sqlMapper);
            TestObject    object1       = TestObject.NewRandom();

            //try...catch... syntax
            try
            {
                sqlMapper.BeginTransaction();
                testObjectDao.Insert(object1);
                testObjectDao.Insert(object1);
                sqlMapper.CommitTransaction();
            }
            catch
            {
                sqlMapper.RollBackTransaction();
            }

            TestObject object2 = testObjectDao.SelectById(object1.Id);

            Assert.IsNull(object2);
        }
Example #3
0
 private static void AssertObjectsAreTheSame(TestObjectNoEntityType testObject, TestObject existingObject)
 {
     Assert.NotNull(existingObject);
     Assert.True(testObject.Id.Equals(existingObject.Id), "The Id doesn't match.");
     Assert.True(testObject.Age.Equals(existingObject.Age), "The Age doesn't match.");
     Assert.True(testObject.FirstName.Equals(existingObject.FirstName), "The FirstName doesn't match.");
     Assert.True(testObject.Aliases[0].Equals(existingObject.Aliases[0]));
     Assert.True(testObject.Aliases[1].Equals(existingObject.Aliases[1]));
     Assert.True(testObject.Aliases[2].Equals(existingObject.Aliases[2]));
 }
Example #4
0
 public void InsertTwice(TestObject object1)
 {
     _testObjectDao.Insert(object1);
     _testObjectDao.Insert(object1);
 }
Example #5
0
 public virtual void InsertTwo(TestObject object1, TestObject object2)
 {
     Insert(object1);
     Insert(object2);
 }
Example #6
0
 public virtual void InsertTwice_TN(TestObject object1)
 {
     InsertT(object1);
     Insert(object1);
 }
Example #7
0
 public virtual void InsertTwiceT_TT(TestObject object1)
 {
     InsertT(object1);
     InsertT(object1);
 }
Example #8
0
 public virtual void InsertTwiceT(TestObject object1)
 {
     _testObjectDao.Insert(object1);
     _testObjectDao.Insert(object1);
 }