forked from samus/mongodb-csharp
/
GridTestBase.cs
executable file
·38 lines (32 loc) · 1.11 KB
/
GridTestBase.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Configuration;
using System.Text;
using NUnit.Framework;
using MongoDB.Driver;
namespace MongoDB.GridFS
{
public abstract class GridTestBase : MongoTestBase
{
/// <summary>
/// Comma separated list of collections to clean at startup.
/// </summary>
public abstract string TestFileSystems{get;}
/// <summary>
/// Turns the TestFileSystems string into a comma delimited set of collections
/// </summary>
public override string TestCollections {
get {
StringBuilder sb = new StringBuilder();
foreach(string fs in this.TestFileSystems.Split(',')){
sb.Append(fs + ".files,");
sb.Append(fs + ".chunks,");
}
sb.Remove(sb.Length - 1,1); //remove last ,
return sb.ToString();
}
}
public long CountChunks(string filesystem, Object fileid){
return DB[filesystem + ".chunks"].Count(new Document().Append("files_id", fileid));
}
}
}