initial
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace PoweredSoft.ObjectStorage.MongoDB.Tests.Mock.Dal
|
||||
{
|
||||
[MongoCollection("contacts")]
|
||||
public class Contact
|
||||
{
|
||||
[BsonId, BsonElement("id")]
|
||||
public ObjectId Id { get; set; }
|
||||
[BsonElement("firstName")]
|
||||
public string FirstName { get; set; }
|
||||
[BsonElement("lastName")]
|
||||
public string LastName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace PoweredSoft.ObjectStorage.MongoDB.Tests.Mock.Dal
|
||||
{
|
||||
[MongoCollection("tags")]
|
||||
public class Tag
|
||||
{
|
||||
[BsonId, BsonElement("id")]
|
||||
public ObjectId Id { get; set; }
|
||||
[BsonElement("name")]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace PoweredSoft.ObjectStorage.MongoDB.Tests.Mock
|
||||
{
|
||||
public class MongoDatabaseFactory
|
||||
{
|
||||
public static IMongoDatabase GetDatabase()
|
||||
{
|
||||
var client = GetClient();
|
||||
var db = client.GetDatabase("acme");
|
||||
return db;
|
||||
}
|
||||
|
||||
public static MongoObjectStorageClient GetObjectStorageClient()
|
||||
{
|
||||
return new MongoObjectStorageClient(GetDatabase());
|
||||
}
|
||||
|
||||
public static IMongoClient GetClient()
|
||||
{
|
||||
var mongoClient = new MongoClient();
|
||||
return mongoClient;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user