mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
40 lines
1.2 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System;
|
|
using MongoDB.Driver;
|
|
using MongoDB.Driver.GridFS;
|
|
|
|
namespace Squidex.Infrastructure.Assets
|
|
{
|
|
public sealed class MongoGridFSAssetStoreFixture : IDisposable
|
|
{
|
|
public MongoGridFsAssetStore AssetStore { get; }
|
|
|
|
public IMongoClient MongoClient { get; } = new MongoClient("mongodb://localhost");
|
|
|
|
public IMongoDatabase MongoDatabase { get; }
|
|
|
|
public MongoGridFSAssetStoreFixture()
|
|
{
|
|
MongoDatabase = MongoClient.GetDatabase("GridFSTest");
|
|
|
|
var gridFSBucket = new GridFSBucket<string>(MongoDatabase, new GridFSBucketOptions
|
|
{
|
|
BucketName = "fs"
|
|
});
|
|
|
|
AssetStore = new MongoGridFsAssetStore(gridFSBucket);
|
|
AssetStore.InitializeAsync().Wait();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
MongoClient.DropDatabase("GridFSTest");
|
|
}
|
|
}
|
|
}
|
|
|