Created
June 2, 2011 10:39
-
-
Save SergXIIIth/1004230 to your computer and use it in GitHub Desktop.
Mongo gridfg upload test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using NUnit.Framework; | |
using MongoDB.Driver; | |
using System.Web.Mvc; | |
using System.IO; | |
using MongoDB.Driver.GridFS; | |
namespace Tests.Unit | |
{ | |
[TestFixture] | |
public class MongoTest | |
{ | |
[Test] | |
public void upload_in_gridFS_file_more_50mb() | |
{ | |
var server = MongoServer.Create("mongodb://localhost:27017/HYPOXI"); | |
var fs = server.GetDatabase("HYPOXI").GridFS; | |
// upload 100mb file few times | |
for (var i = 1; i <= 10; i++) { | |
"{0} ,".debug_w(i); | |
var content_type = "application/octetstream"; | |
var file_name = "bigfile.exe"; | |
fs.Delete(file_name); | |
using (var file_stream = File.OpenRead(file_name)) { | |
fs.Upload(file_stream, file_name, new MongoGridFSCreateOptions { ContentType = content_type }); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment