public TestMongoDb(ITestOutputHelper output) { MongoDbConfig mongoDbConfig = MongoDbConfig.GetMongoDbConfig(@"C:\Users\t-chwang\source\repos\ImageServingPlatform\Tests\mongodbconfig.json"); this.context = new MediaRecordMongoDatabaseContext(mongoDbConfig); manager = new ImageMongoDbManager(context); this.output = output; }
public static ImageService GetImageService(BlobStorageConfig blobStorageConfig, MongoDbConfig mongoDbConfig) { BlobStorage blobStorage = new BlobStorage(blobStorageConfig); ImageProcessor imageProcessor = new ImageProcessor(); //ImageDBManager imageDBManager = new ImageDBManager // (new MediaRecordDatabaseContext()); MediaRecordMongoDatabaseContext mongoDbContext = new MediaRecordMongoDatabaseContext(mongoDbConfig); ImageMongoDbManager imageDBManager = new ImageMongoDbManager(mongoDbContext); Core.ImageService imageService = new Core.ImageService( blobStorageConfig, imageProcessor, blobStorage, imageDBManager); return(imageService); }
static void TestMongoModelGetIdByMD5() { MediaRecordMongoDatabaseContext context; ImageMongoDbManager manager; MongoDbConfig mongoDbConfig = MongoDbConfig.GetMongoDbConfig(@"C:\Users\t-chwang\source\repos\ImageServingPlatform\Core\DBManager\resource\mongodbconfig.json"); context = new MediaRecordMongoDatabaseContext(mongoDbConfig); manager = new ImageMongoDbManager(context); String str = manager.GetIdByMD5(0xdead); str = manager.GetIdByMD5(123); Console.WriteLine(str); }
static void TestMongoModel() { MediaRecordMongoDatabaseContext context; ImageMongoDbManager manager; MongoDbConfig mongoDbConfig = MongoDbConfig.GetMongoDbConfig(@"C:\Users\t-chwang\source\repos\ImageServingPlatform\Core\DBManager\resource\mongodbconfig.json"); context = new MediaRecordMongoDatabaseContext(mongoDbConfig); manager = new ImageMongoDbManager(context); Image image = new Image { Width = 500, Height = 500, BlobName = "Shit", MD5 = 123 }; image = manager.Create(image); Console.WriteLine(image.Id); }