Пример #1
0
        private static async Task <int> OnUpload(UploadOptions options)
        {
            Console.WriteLine(
                $"Uploading global storage blob list for scid : {options.ServiceConfigurationId}, sandbox {options.Sandbox}, path {options.Path}, type {options.Type}");

            byte[] blobData = File.ReadAllBytes(options.File);

            await TitleStorage.UploadGlobalStorageBlobAsync(options.ServiceConfigurationId, options.Sandbox, options.Path,
                                                            (TitleStorageBlobType)options.Type, blobData);

            Console.WriteLine("Global storage blob uploaded.");

            return(0);
        }
Пример #2
0
        public async Task UploadBlob()
        {
            this.SetUpMockAuth();
            this.SetupMockBytes();

            var uri = new Uri(new Uri(ClientSettings.Singleton.TitleStorageEndpoint), $"global/scids/{DefaultScid}/data/{DefaultGlobalStoragePath},{DefaultFileType}");

            var mockHttp = new MockHttpMessageHandler();

            mockHttp.Expect(HttpMethod.Put, uri.ToString())
            .WithHeaders("Authorization", this.ExpectedToken(DefaultScid, DefaultSandbox))
            .Respond("application/json", "{}");

            TestHook.MockHttpHandler = mockHttp;

            TitleStorageBlobType fileType = (TitleStorageBlobType)Enum.Parse(typeof(TitleStorageBlobType), DefaultFileType, true);
            await TitleStorage.UploadGlobalStorageBlobAsync(DefaultScid, DefaultSandbox, DefaultGlobalStoragePath, fileType, this.defaultBytes);
        }