public void TransactionScope_ShouldNotPromoteToDTC2() { TestTool.RunTasks(10, () => { using (var txScope = AdoTool.CreateTransactionScope()) { var count = TotalCount(); var ds = NorthwindAdoRepository.ExecuteDataSetBySqlString(SQL_REGION_SELECT, 1, 10); var dt = NorthwindAdoRepository.ExecuteDataTableBySqlString(SQL_REGION_SELECT, 1, 10); Assert.IsFalse(ds.Tables[0].HasErrors); Assert.IsFalse(dt.HasErrors); int rows = NorthwindAdoRepository.ExecuteNonQueryBySqlString(SQL_REGION_INSERT); Assert.AreEqual(1, rows); rows = NorthwindAdoRepository.ExecuteNonQueryBySqlString(SQL_REGION_INSERT2); Assert.AreEqual(1, rows); NorthwindAdoRepository.ExecuteNonQueryBySqlString(SQL_REGION_DELETE); ds = NorthwindAdoRepository.ExecuteDataSetBySqlString(SQL_REGION_SELECT); dt = NorthwindAdoRepository.ExecuteDataTableBySqlString(SQL_REGION_SELECT); txScope.Complete(); } }); }
public static void MethodInTransaction() { using (var table = NorthwindAdoRepository.ExecuteDataTableBySqlString("SELECT * FROM sysobjects")) { Assert.IsFalse(table.HasErrors); Console.WriteLine("Data Table has {0} records", table.Rows.Count); } }
public void ExecuteDataTableBySqlString(int firstResult, int maxResults) { using (var table = NorthwindAdoRepository.ExecuteDataTableBySqlString(GetOrderDetailsSql, firstResult, maxResults)) { Assert.IsFalse(table.HasErrors); Assert.Greater(table.Rows.Count, 0); Console.WriteLine("RowCount=[{0}]", table.Rows.Count); } }
public void TransactionScope_ShouldNotPromoteToDTC3() { TestTool.RunTasks(10, () => AdoWith.TransactionScope(TransactionScopeOption.Required, System.Transactions.IsolationLevel.ReadCommitted, delegate { var count = TotalCount(); }, delegate { NorthwindAdoRepository.ExecuteNonQueryBySqlString(SQL_REGION_INSERT); NorthwindAdoRepository.ExecuteNonQueryBySqlString(SQL_REGION_INSERT2); NorthwindAdoRepository.ExecuteNonQueryBySqlString(SQL_REGION_DELETE); }, delegate { var ds = NorthwindAdoRepository.ExecuteDataSetBySqlString( SQL_REGION_SELECT, 1, 10); }, delegate { var dt = NorthwindAdoRepository.ExecuteDataTableBySqlString( SQL_REGION_SELECT, 1, 10); } )); }
public void MapFromDataTableExcludeProperty(int firstResult, int maxResults) { // Total 속성의 값은 매핑하지 않는다. // using ( var table = NorthwindAdoRepository.ExecuteDataTableByProcedure("CustOrderHist", firstResult, maxResults, CustomerTestParameter)) { var histories = table.Map <CustomerOrderHistory>(new[] { "Total" }).ToList(); if (maxResults > 0) { Assert.GreaterOrEqual(maxResults, histories.Count); } else { Assert.Greater(histories.Count, 0); } histories.All(x => x.Total == 0).Should().Be.True(); } using (var table = NorthwindAdoRepository.ExecuteDataTableBySqlString(SQL_CUSTOMER_SELECT, firstResult, maxResults)) { var customers = table.Map <Customer>(new string[0]); if (maxResults > 0) { Assert.GreaterOrEqual(maxResults, customers.Count); } else { Assert.Greater(customers.Count, 0); } customers.All(c => c.CustomerID.IsNotWhiteSpace()).Should().Be.True(); customers.All(c => c.Address.IsNotWhiteSpace()).Should().Be.True(); } }
//[TestCase(0, 50)] //[TestCase(5, 200)] public void MapPersistenceFromDataTable(int firstResult, int maxResults) { // 단순히 TrimMapper 를 이용하여 Persistence를 생성합니다. // using ( var table = NorthwindAdoRepository.ExecuteDataTableByProcedure("CustOrderHist", firstResult, maxResults, CustomerTestParameter)) { var histories = table.Map <CustomerOrderHistory>().ToList(); if (maxResults > 0) { Assert.GreaterOrEqual(maxResults, histories.Count); } else { Assert.Greater(histories.Count, 0); } histories.TrueForAll(h => h.Total.GetValueOrDefault(0) > 0); } using (var table = NorthwindAdoRepository.ExecuteDataTableBySqlString(SQL_CUSTOMER_SELECT, firstResult, maxResults)) { var customers = table.Map <Customer>().ToList(); if (maxResults > 0) { Assert.GreaterOrEqual(maxResults, customers.Count); } else { Assert.Greater(customers.Count, 0); } customers.All(c => c.CustomerID.IsNotWhiteSpace()).Should().Be.True(); customers.All(c => c.Address.IsNotWhiteSpace()).Should().Be.True(); } }
public static void SelectRegions() { using (var table = NorthwindAdoRepository.ExecuteDataTableBySqlString(SQL_REGION_SELECT)) { Assert.Greater(table.Rows.Count, 0); } }