public void TestInsertCategoryScope() { Category category = new Category(); category.Name = "toto"; category.Guid = Guid.NewGuid(); dataMapper.QueryForObject("InsertCategoryScope", category, category); Assert.That(category.Id, Is.EqualTo(1)); }
public void TestInsertIdentityViaInsertQuery() { Category category = new Category(); category.Name = "toto"; category.Guid = Guid.NewGuid(); int key = (int)dataMapper.Insert("InsertCategory", category); Assert.AreEqual(1, key); }
public void GenericTestInsertCategoryWithProperties() { Category category = new Category(); category.Guid = Guid.NewGuid(); int key = (int)dataMapper.Insert("InsertCategoryWithProperties", category); Category categoryTest = dataMapper.QueryForObject<Category>("GetCategory", key); Assert.AreEqual(key, categoryTest.Id); Assert.AreEqual("Film", categoryTest.Name); Assert.AreEqual(category.Guid, categoryTest.Guid); }
public void TestMultipleResultClass() { Category category = new Category(); category.Name = "toto"; category.Guid = Guid.NewGuid(); int key = (int)dataMapper.Insert("InsertCategory", category); IList list = dataMapper.QueryForList("GetMultipleResultClass", null); Assert.AreEqual(2, list.Count); Assert.IsInstanceOf(typeof(List<Account>),list[0]); Assert.IsInstanceOf(typeof(List<Category>),list[1]); }
public void TestMultipleResultMap() { Category category = new Category(); category.Name = "toto"; category.Guid = Guid.NewGuid(); int key = (int)dataMapper.Insert("InsertCategory", category); IList list = dataMapper.QueryForList("GetMultipleResultMap", null); Assert.AreEqual(2, list.Count); List<Account> accounts = (List<Account>)list[0]; List<Category> categorys = (List<Category>)list[1]; AssertAccount1(accounts[0]); Assert.AreEqual(key, categorys[0].Id); Assert.AreEqual(category.Name, categorys[0].Name); Assert.AreEqual(category.Guid, categorys[0].Guid); }
public void TestDynamicWithGUID() { Category category = new Category(); category.Name = "toto"; category.Guid = Guid.Empty; int key = (int)dataMapper.Insert("InsertCategory", category); category = new Category(); category.Name = "titi"; category.Guid = Guid.NewGuid(); Category categoryTest = (Category)dataMapper.QueryForObject("DynamicGuid", category); Assert.IsNull(categoryTest); category = new Category(); category.Name = "titi"; category.Guid = Guid.Empty; categoryTest = (Category)dataMapper.QueryForObject("DynamicGuid", category); Assert.IsNotNull(categoryTest); }
public void TestTimeSpan() { Guid newGuid = Guid.NewGuid();; Category category = new Category(); category.Name = "toto"; category.Guid = newGuid; int key = (int)dataMapper.Insert("InsertCategory", category); Guid guid = (Guid)dataMapper.QueryForObject("GetGuid", key); Assert.AreEqual(newGuid, guid); }
public void TestJIRA176() { Category category = new Category(); category.Name = "toto"; category.Guid = Guid.Empty; int key = (int)dataMapper.Insert("InsertCategory", category); ImmutableCategoryPropertyContainer categoryContainerFromDB = (ImmutableCategoryPropertyContainer)dataMapper.QueryForObject("GetImmutableCategoryInContainer", key); Assert.IsNotNull(categoryContainerFromDB); Assert.IsNotNull(categoryContainerFromDB.ImmutableCategory); Assert.AreEqual(category.Name, categoryContainerFromDB.ImmutableCategory.Name); Assert.AreEqual(key, categoryContainerFromDB.ImmutableCategory.Id); Assert.AreEqual(category.Guid, categoryContainerFromDB.ImmutableCategory.Guid); }
public void TestInsertSelectKey() { if (configurationSetting.UseStatementNamespaces) { Category category = new Category(); category.Name = "toto"; category.Guid = Guid.NewGuid(); int key = (int) dataMapper.Insert("Category.InsertCategoryViaInsertStatement", category); Assert.AreEqual(1, key); } else { Assert.Ignore("UseStatementNamespaces is false, skipping"); } }
public void GenericTestGuidColumn() { Category category = new Category(); category.Name = "toto"; category.Guid = Guid.NewGuid(); int key = (int)dataMapper.Insert("InsertCategory", category); Category categoryTest = dataMapper.QueryForObject<Category>("GetCategory", key); Assert.AreEqual(key, categoryTest.Id); Assert.AreEqual(category.Name, categoryTest.Name); Assert.AreEqual(category.Guid, categoryTest.Guid); }
public void GenericTestUpdateCategoryWithExtendParameterMap() { Category category = new Category(); category.Name = "Cat"; category.Guid = Guid.NewGuid(); int key = (int)dataMapper.Insert("InsertCategoryViaParameterMap", category); category.Id = key; category.Name = "Dog"; category.Guid = Guid.NewGuid(); dataMapper.Update("UpdateCategoryViaParameterMap", category); Category categoryRead = null; categoryRead = dataMapper.QueryForObject<Category>("GetCategory", key); Assert.AreEqual(category.Id, categoryRead.Id); Assert.AreEqual(category.Name, categoryRead.Name); Assert.AreEqual(category.Guid.ToString(), categoryRead.Guid.ToString()); }
public void InsertTestIdentityViaProcedure() { Category category = new Category(); category.Name = "Mapping object relational"; dataMapper.Insert("InsertCategoryViaStoreProcedure", category); Assert.AreEqual(1, category.Id ); category = new Category(); category.Name = "Nausicaa"; dataMapper.QueryForObject("InsertCategoryViaStoreProcedure", category); Assert.AreEqual(2, category.Id ); }
public void InsertTestIdentityViaProcedureWithReturn ( ) { Category category = new Category ( ); category.Name = "Mapping object relational"; int categoryID = ( int ) dataMapper.Insert ( "InsertCategoryViaStoreProcedureWithReturn", category ); Assert.That(categoryID, Is.EqualTo(1)); Assert.That(category.Id, Is.EqualTo(1)); Category category2 = new Category ( ); category2.Name = "Nausicaa"; int categoryID2 = ( int ) dataMapper.Insert ( "InsertCategoryViaStoreProcedureWithReturn", category2 ); Assert.That(categoryID2, Is.EqualTo(2)); Assert.That(category2.Id, Is.EqualTo(2)); Category category3 = dataMapper.QueryForObject<Category> ( "GetCategory", categoryID2 ) ; Category category4 = dataMapper.QueryForObject<Category> ( "GetCategory", categoryID ); Assert.AreEqual ( categoryID2, category3.Id ); Assert.AreEqual ( category2.Name, category3.Name ); Assert.AreEqual ( categoryID, category4.Id ); Assert.AreEqual ( category.Name, category4.Name ); }
public void TestInsertCategoryViaParameterMap() { Category category = new Category(); category.Name = "Cat"; category.Guid = Guid.NewGuid(); int key = (int)dataMapper.Insert("InsertCategoryViaParameterMap", category); Assert.AreEqual(1, key); }
public void TestNullValueReplacementForGuidValue() { Category category = new Category(); category.Name = "Toto"; category.Guid = Guid.Empty; int key = (int)dataMapper.Insert("InsertCategoryNull", category); Category categoryRead = null; categoryRead = (Category)dataMapper.QueryForObject("GetCategoryWithNullValueReplacementGuid", key); Assert.AreEqual(category.Name, categoryRead.Name); Assert.AreEqual(category.Guid.ToString(), categoryRead.Guid.ToString()); }