Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

48 lines (38 sloc) 1.272 kB
using System;
using NUnit.Framework;
using MongoDB.Driver;
using MongoDB.Driver.GridFS;
namespace MongoDB.Driver.GridFS
{
[TestFixture]
public class GridFSTest{
Mongo db = new Mongo();
[Test]
public void TestOpenNewGridFile()
{
GridFile gridFS = new GridFile(db["tests"]);
using (GridFileInfo gf = new GridFileInfo(gridFS))
{
gf.Open("newfile.txt");
Console.WriteLine(gf.Id.ToString());
}
}
[Test]
public void TestFileDoesNotExist(){
GridFile fs = new GridFile(db["tests"]);
Assert.IsFalse(fs.Exists("non-existent filename"));
}
[TestFixtureSetUp]
public void Init(){
db.Connect();
CleanDB(); //Run here instead of at the end so that the db can be examined after a run.
}
[TestFixtureTearDown]
public void Dispose(){
db.Disconnect();
}
protected void CleanDB(){
//Any collections that we might want to delete before the tests run should be done here.
}
}
}
Jump to Line
Something went wrong with that request. Please try again.