Пример #1
0
 public void ExecuteDataTableByQuery(int firstResult, int maxResults)
 {
     using (var table = NorthwindAdoRepository.ExecuteDataTable(GetOrderDetailsSql, firstResult, maxResults)) {
         Assert.IsFalse(table.HasErrors);
         Assert.Greater(table.Rows.Count, 0);
         Console.WriteLine("RowCount=[{0}]", table.Rows.Count);
     }
 }
Пример #2
0
 public void _WarmUpTablesForAccuracy()
 {
     foreach (var section in Sections)
     {
         var query = NorthwindAdoRepository.QueryProvider.GetQuery(section, QueryKey);
         using (var table = NorthwindAdoRepository.ExecuteDataTable(query)) {
             Assert.IsFalse(table.HasErrors);
         }
     }
 }
Пример #3
0
        public void ExecuteDataTableAndCopy(int firstResult, int maxResults)
        {
            // DataTable을 반환받아 다른 DataSet에 저장할 수 있는지 파악한다.

            using (var dataset = new DataSet())
                using (var cmd = NorthwindAdoRepository.GetCommand(GetOrderDetailsSql))
                    using (var table = NorthwindAdoRepository.ExecuteDataTable(cmd, firstResult, maxResults)) {
                        Assert.IsFalse(table.HasErrors);
                        Assert.Greater(table.Rows.Count, 0);
                        Console.WriteLine("RowCount=[{0}]", table.Rows.Count);

                        dataset.Tables.Add(table);
                        Assert.AreEqual(1, dataset.Tables.Count);
                    }
        }
Пример #4
0
        public void Can_Create_Command_By_NamedQueryCommand_With_QueryKey(string queryKey)
        {
            NorthwindAdoRepository.QueryProvider.Should("NorthwindRepository.QueryProvider").Not.Be.Null();

            using (var cmd = NorthwindAdoRepository.GetNamedQueryCommand(queryKey))
                using (var dataTable = NorthwindAdoRepository.ExecuteDataTable(cmd)) {
                    Assert.IsNotNull(dataTable);
                    Assert.IsFalse(dataTable.HasErrors);
                    Assert.IsTrue(dataTable.Rows.Count > 0);
                }

            using (var dataTable = NorthwindAdoRepository.ExecuteDataTable(queryKey)) {
                dataTable.Should().Not.Be.Null();
                Assert.IsFalse(dataTable.HasErrors);
                Assert.IsTrue(dataTable.Rows.Count > 0);
            }
        }
Пример #5
0
        public void Can_Create_Command_By_NamedQueryCommand_With_Section_And_QueryName(string section, string queryName)
        {
            if (NorthwindAdoRepository.QueryProvider != null)
            {
                using (var cmd = NorthwindAdoRepository.GetNamedQueryCommand(section, queryName))
                    using (var dataTable = NorthwindAdoRepository.ExecuteDataTable(cmd)) {
                        Assert.IsNotNull(dataTable);
                        Assert.IsFalse(dataTable.HasErrors);
                        Assert.IsTrue(dataTable.Rows.Count > 0);
                    }

                var queryKey = string.Concat(section, ",", queryName);
                using (var dataTable = NorthwindAdoRepository.ExecuteDataTable(queryKey)) {
                    Assert.IsNotNull(dataTable);
                    Assert.IsFalse(dataTable.HasErrors);
                    Assert.IsTrue(dataTable.Rows.Count > 0);
                }
            }
        }