コード例 #1
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);
            }
        }
コード例 #2
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);
                }
            }
        }