static void TestGetConfig() { BlobStorageConfig config = BlobStorageConfig.GetConfig("C:/Users/t-chwang/source/repos/ImageServingPlatform/Core/config.json"); Console.WriteLine(config.StorageConnectionStringFile); Console.WriteLine(config.StorageConnectionString); }
static void TestUploadBlob() { BlobStorageConfig config = BlobStorageConfig.GetConfig("C:/Users/t-chwang/source/repos/ImageServingPlatform/Core/config.json"); BlobStorage blobStorage = new BlobStorage(config); FileStream fs = new FileStream("C:/Users/t-chwang/source/repos/ImageServingPlatform/Core/Resource/testpic/github-octocat.png", FileMode.Open); Task <Uri> t = blobStorage.UploadAsync(fs, "abc.png"); t.Wait(); Console.WriteLine(t.Result); }
static async void TestUploadBinaryAsync() { BlobStorageConfig config = BlobStorageConfig.GetConfig("C:/Users/t-chwang/source/repos/ImageServingPlatform/Core/config.json"); BlobStorage blobStorage = new BlobStorage(config); ImageProcessor imageProcessor = new ImageProcessor(); ImageDBManager imageDBManager = new ImageDBManager(new MediaRecordDatabaseContext()); ImageService imageService = new ImageService(config, imageProcessor, blobStorage, imageDBManager); FileStream fs = new FileStream("C:/Users/t-chwang/source/repos/ImageServingPlatform/Core/Resource/testpic/github-octocat.png", FileMode.Open); byte[] fileContent = new BinaryReader(fs).ReadBytes((int)fs.Length); Console.WriteLine(fileContent.Length); fs.Close(); await imageService.UploadBinaryAsync(fileContent, "abc.png"); Console.WriteLine("End of TestUploadBinaryAsync. "); }