/// <summary> /// /// </summary> /// /// <param name="reader"></param> /// /// <returns></returns> /// public static TestEntity GetTestEntityEntity(IDataReader reader) { TestEntity entity = new TestEntity(); entity.Id = Convert.ToInt64(reader["Id"]); entity.Name = Convert.ToString(reader["Name"]); entity.Description = Convert.ToString(reader["Description"]); return entity; }
public void TestAffiliateEntityCollection() { TestEntity affiliate = new TestEntity(); affiliate.Id = 1000; TestEntity affiliate0 = new TestEntity(); affiliate0.Id = 1001; TestEntity affiliate1 = new TestEntity(); affiliate1.Id = 1002; EntityCollection<TestEntity> collection = new EntityCollection<TestEntity>(); collection.Add(affiliate); collection.Add(affiliate0); collection.Add(affiliate1); foreach (TestEntity aff in collection) { Console.WriteLine("Affiliate: {0}", aff.Id); } }
public void TestGetCSV() { TestEntity affiliate = new TestEntity(); affiliate.Id = 1000; affiliate.Description = "desc 1"; TestEntity affiliate0 = new TestEntity(); affiliate0.Id = 1001; affiliate0.Description = "desc 2"; TestEntity affiliate1 = new TestEntity(); affiliate1.Id = 1002; affiliate1.Description = "desc 3"; String[] stringArray = new string[] { "amin", "abel" }; affiliate1.StringArray = stringArray; EntityCollection<TestEntity> collection = new EntityCollection<TestEntity>(); collection.Add(affiliate); collection.Add(affiliate0); collection.Add(affiliate1); Console.Write(collection.GetCSV()); }
public void TestEntityCollectionOperatorOverloading() { EntityCollection<TestEntity> collection = new EntityCollection<TestEntity>(); TestEntity lead = new TestEntity(); lead.Id = 1000; collection.Add(lead); EntityCollection<TestEntity> otherCollection = new EntityCollection<TestEntity>(); TestEntity otherLead = new TestEntity(); otherLead.Id = 2000; otherCollection.Add(otherLead); EntityCollection<TestEntity> finalCollection = collection + otherCollection; foreach (TestEntity tempLead in finalCollection) { Console.WriteLine("Lead: " + tempLead.Id); } }
public void TestEntityCollectionMerge() { EntityCollection<TestEntity> collection = new EntityCollection<TestEntity>(); TestEntity lead = new TestEntity(); lead.Id = 1000; collection.Add(lead); EntityCollection<TestEntity> otherCollection = new EntityCollection<TestEntity>(); TestEntity otherLead = new TestEntity(); otherLead.Id = 2000; otherCollection.Add(otherLead); collection.Merge(otherCollection); foreach (TestEntity tempLead in collection) { Console.WriteLine("Lead: " + tempLead.Id); } }
public void TestDataViewEntityCollection() { TestEntity affiliate = new TestEntity(); affiliate.Id = 1000; TestEntity affiliate0 = new TestEntity(); affiliate0.Id = 1001; TestEntity affiliate1 = new TestEntity(); affiliate1.Id = 1002; EntityCollection<TestEntity> collection = new EntityCollection<TestEntity>(); collection.Add(affiliate); collection.Add(affiliate0); collection.Add(affiliate1); foreach (TestEntity aff in collection) { Console.WriteLine("Affiliate: {0}", aff.Id); } DataView view = collection.GetDataView(typeof(TestEntity)); view.ToString(); }
public void TestUpdate() { TestEntity entity = new TestEntity(1, "TestEntity", "Update Test Case for DataAccess."); dataAccess.Update(entity); TestEntity result = dataAccess.Select(1, rowMapper); Assert.IsNotNull(result); Assert.AreEqual("Update Test Case for DataAccess.", result.Description); Console.WriteLine(result); }
public void TestInsert() { TestEntity entity = new TestEntity(1, "TestEntity", "Insert Test Case for DataAccess."); TestEntity result = dataAccess.Insert(entity, rowMapper); Assert.IsNotNull(result); Assert.IsNotNull(result.Id); Console.WriteLine(result); }