本文整理汇总了C#中QueriableDummy.Count方法的典型用法代码示例。如果您正苦于以下问题:C# QueriableDummy.Count方法的具体用法?C# QueriableDummy.Count怎么用?C# QueriableDummy.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueriableDummy
的用法示例。
在下文中一共展示了QueriableDummy.Count方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSimpleCountReturn
public void TestSimpleCountReturn()
{
var q = new QueriableDummy<ntup2>();
var result = q.Count();
Assert.IsNotNull(DummyQueryExectuor.FinalResult, "final result");
var r = DummyQueryExectuor.FinalResult.ResultValue;
Assert.AreEqual(typeof(int), r.Type, "result type");
Assert.AreEqual(DeclarableParameter.ExpressionType, r.NodeType, "Expression type incorrect");
var dv = r as DeclarableParameter;
Assert.IsTrue(dv.InitialValue == null || dv.InitialValue.RawValue == "0", "Initial value incorrect");
}
示例2: TestLoadingCommonFiles
public void TestLoadingCommonFiles()
{
/// Create a common C++ object that can be loaded and checked for.
var d = PrepNonSpaceDir("TestLoadingCommonFiles");
string fnamebase = "TestLoadingCommonFilesObj";
var f = CreateCommonObject(fnamebase, d);
///
/// Run a simple query - but fool it against another ntuple
///
var rootFile = TestUtils.CreateFileOfInt(1);
var q = new QueriableDummy<TestNtupe>();
var dude = q.Count();
var query = DummyQueryExectuor.LastQueryModel;
///
/// First, make sure to clear out the common area. We are relying on the fact that we know
/// where the common area is for this step.
///
var commonArea = new DirectoryInfo(Path.GetTempPath() + @"\LINQToROOT\CommonFiles");
if (commonArea.Exists)
{
var filesToKill = (from fd in commonArea.EnumerateFiles()
where fd.Name.Contains(fnamebase)
select fd).ToArray();
foreach (var theFile in filesToKill)
{
theFile.Delete();
}
}
///
/// Setup all the files we will have to have!
///
///
/// Generate a proxy .h file that we can use
///
var proxyFile = TestUtils.GenerateROOTProxy(rootFile, "dude");
ntuple._gProxyFile = proxyFile.FullName;
ntuple._gObjectFiles = new string[] { f.FullName };
///
/// Now run
///
var exe = new TTreeQueryExecutor(new[] { rootFile }, "dude", typeof(ntuple), typeof(TestNtupe));
int result = exe.ExecuteScalar<int>(query);
Assert.AreEqual(1, result, "The result should have run correctly.");
///
/// Next, see if we can find the files in the common area.
///
commonArea.Refresh();
Assert.IsTrue(commonArea.Exists, string.Format("The common build area doesn't exist currently ({0}).", commonArea.FullName));
var filesFromOurObj = (from fd in commonArea.EnumerateFiles()
where fd.Name.Contains(fnamebase)
select fd).ToArray();
Assert.IsTrue(filesFromOurObj.Length > 0, "no files from our common object");
}
示例3: TestDualQueryOnSameQueriable
public void TestDualQueryOnSameQueriable()
{
var rootFile = TestUtils.CreateFileOfInt(5);
///
/// Generate a proxy .h file that we can use
///
var proxyFile = TestUtils.GenerateROOTProxy(rootFile, "dude");
///
/// Get a simple query we can "play" with
///
var q = new QueriableDummy<TestNtupe>();
var dude = q.Count();
var query = DummyQueryExectuor.LastQueryModel;
///
/// Ok, now we can actually see if we can make it "go".
///
ntuple._gProxyFile = proxyFile.FullName;
var exe = new TTreeQueryExecutor(new[] { rootFile }, "dude", typeof(ntuple), typeof(TestNtupe));
int result = exe.ExecuteScalar<int>(query);
///
/// Run the second one now
///
var dude1 = q.Where(e => e.run > 10).Count();
query = DummyQueryExectuor.LastQueryModel;
result = exe.ExecuteScalar<int>(query);
}
示例4: TestTempDirectoryLocationAndEmptying
public void TestTempDirectoryLocationAndEmptying()
{
var rootFile = TestUtils.CreateFileOfInt(1);
///
/// Get a simple query we can "play" with
///
var q = new QueriableDummy<TestNtupe>();
var dude = q.Count();
var query = DummyQueryExectuor.LastQueryModel;
///
/// Generate a proxy .h file that we can use
///
var proxyFile = TestUtils.GenerateROOTProxy(rootFile, "dude");
ntuple._gProxyFile = proxyFile.FullName;
///
/// Ok, now we can actually see if we can make it "go".
///
var exe = new TTreeQueryExecutor(new[] { rootFile }, "dude", typeof(ntuple), typeof(TestNtupe));
int result = exe.ExecuteScalar<int>(query);
var dir = new DirectoryInfo(Path.GetTempPath() + "\\LINQToROOT"); ;
dir.Refresh();
Assert.IsTrue(dir.Exists, "Temp directory doesn't exist");
Assert.AreEqual(0, dir.EnumerateFiles().Count(), "Expected no spare files in there!");
Assert.AreEqual(2, dir.EnumerateDirectories().Count(), "Incorrect # of subdirectories");
Assert.AreEqual("CommonFiles", dir.GetDirectories()[0].Name, "incorrect name of single existing directory");
}
示例5: TestForZeroInputFiles
public void TestForZeroInputFiles()
{
var rootFile = TestUtils.CreateFileOfInt(5);
///
/// Generate a proxy .h file that we can use
///
var proxyFile = TestUtils.GenerateROOTProxy(rootFile, "dude");
///
/// Get a simple query we can "play" with
///
var q = new QueriableDummy<TestNtupe>();
var dude = q.Count();
var query = DummyQueryExectuor.LastQueryModel;
///
/// Ok, now we can actually see if we can make it "go".
///
ntuple._gProxyFile = proxyFile.FullName;
var exe = new TTreeQueryExecutor(new Uri[] { }, "dude", typeof(ntuple));
int result = exe.ExecuteScalar<int>(query);
}
示例6: TestSimpleResultDebugCompile
public void TestSimpleResultDebugCompile()
{
var rootFile = TestUtils.CreateFileOfInt(10);
///
/// Generate a proxy .h file that we can use
///
var proxyFile = TestUtils.GenerateROOTProxy(rootFile, "dude");
///
/// Get a simple query we can "play" with
///
var q = new QueriableDummy<TestNtupe>();
var dude = q.Count();
var query = DummyQueryExectuor.LastQueryModel;
///
/// Ok, now we can actually see if we can make it "go".
///
ntuple._gProxyFile = proxyFile.FullName;
var exe = new TTreeQueryExecutor(new[] { rootFile }, "dude", typeof(ntuple), typeof(TestNtupe));
exe.CompileDebug = true;
int result = exe.ExecuteScalar<int>(query);
Assert.AreEqual(10, result);
}
示例7: TestSimpleReultOperatorNtupleOkButBogusProxyPath
public void TestSimpleReultOperatorNtupleOkButBogusProxyPath()
{
int numberOfIter = 10;
var rootFile = TestUtils.CreateFileOfInt(numberOfIter);
///
/// Get a simple query we can "play" with
///
var q = new QueriableDummy<TestNtupe>();
var dude = q.Count();
var query = DummyQueryExectuor.LastQueryModel;
///
/// Ok, now we can actually see if we can make it "go".
///
ntuple._gProxyFile = "junk.cppxdude";
var exe = new TTreeQueryExecutor(new[] { rootFile }, "dude", typeof(ntuple));
int result = exe.ExecuteScalar<int>(query);
Assert.AreEqual(numberOfIter, result);
}