Ejemplo n.º 1
0
        private static async Task <int> OnGetQuota(QuotaOptions options)
        {
            Console.WriteLine($"Getting global storage quota for scid : {options.ServiceConfigurationId}, sandbox {options.Sandbox}");
            GlobalStorageQuotaInfo result =
                await TitleStorage.GetGlobalStorageQuotaAsync(options.ServiceConfigurationId, options.Sandbox);

            Console.WriteLine($"Total bytes : {result.QuotaBytes}, used bytes {result.UsedBytes}");

            return(0);
        }
        public async Task GetQuota()
        {
            SetUpMockAuth();

            string quotaResponse = $"{{'quotaInfo':{{'usedBytes':{DefaultUsedQuota},'quotaBytes':{DefaultQuota}}}}}";

            var uri = new Uri(new Uri(ClientSettings.Singleton.TitleStorageEndpoint), "/global/scids/" + DefaultScid);

            var mockHttp = new MockHttpMessageHandler();

            mockHttp.Expect(uri.ToString())
            .Respond("application/json", quotaResponse);

            TestHook.MockHttpHandler = mockHttp;

            var quotaInfo = await TitleStorage.GetGlobalStorageQuotaAsync(DefaultScid, DefaultSandbox);

            Assert.AreEqual(DefaultQuota, quotaInfo.QuotaBytes);
            Assert.AreEqual(DefaultUsedQuota, quotaInfo.UsedBytes);
        }