当前位置: 首页>>代码示例>>C#>>正文


C# MobileServiceClient.GetPush方法代码示例

本文整理汇总了C#中MobileServiceClient.GetPush方法的典型用法代码示例。如果您正苦于以下问题:C# MobileServiceClient.GetPush方法的具体用法?C# MobileServiceClient.GetPush怎么用?C# MobileServiceClient.GetPush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MobileServiceClient的用法示例。


在下文中一共展示了MobileServiceClient.GetPush方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterAsync_ChannelUri

        public async Task RegisterAsync_ChannelUri()
        {
            MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri);

            var expectedUri = string.Format("{0}{1}/{2}", DefaultServiceUri, InstallationsPath, mobileClient.GetPush().InstallationId);
            string installationRegistration = JsonConvert.SerializeObject(this.pushTestUtility.GetInstallation(mobileClient.GetPush().InstallationId, false));
            var hijack = TestHttpDelegatingHandler.CreateTestHttpHandler(expectedUri, HttpMethod.Put, null, HttpStatusCode.OK, expectedRequestContent: installationRegistration);

            mobileClient = new MobileServiceClient(DefaultServiceUri, hijack);
            await mobileClient.GetPush().RegisterAsync(DefaultChannelUri);
        }
开发者ID:brettsam,项目名称:azure-mobile-apps-net-client,代码行数:11,代码来源:PushUnit.Test.cs

示例2: RegisterAsync_ErrorEmptyChannelUri

 public async Task RegisterAsync_ErrorEmptyChannelUri()
 {
     var mobileClient = new MobileServiceClient(DefaultServiceUri);
     var exception = await AssertEx.Throws<ArgumentNullException>(
    () => mobileClient.GetPush().RegisterAsync(""));
     Assert.AreEqual(exception.Message, "Value cannot be null.\r\nParameter name: channelUri");
 }
开发者ID:brettsam,项目名称:azure-mobile-apps-net-client,代码行数:7,代码来源:PushUnit.Test.cs

示例3: RegisterAsync_ErrorEmptyChannelUri

 public async Task RegisterAsync_ErrorEmptyChannelUri()
 {
     var mobileClient = new MobileServiceClient(DefaultServiceUri);
     NSData deviceToken = null;
     var exception = await AssertEx.Throws<ArgumentNullException>(() => mobileClient.GetPush().RegisterAsync(deviceToken));
     Assert.AreEqual(exception.ParamName, "deviceToken");
 }
开发者ID:Azure,项目名称:azure-mobile-apps-net-client,代码行数:7,代码来源:PushUnit.Test.cs

示例4: RegisterAsync_ErrorEmptyChannelUri

 public async Task RegisterAsync_ErrorEmptyChannelUri()
 {
     var mobileClient = new MobileServiceClient(DefaultServiceUri);
     string emptyRegistrationId = string.Empty;
     var exception = await AssertEx.Throws<ArgumentNullException>(() => mobileClient.GetPush().RegisterAsync(emptyRegistrationId));
     Assert.AreEqual(exception.ParamName, "registrationId");
 }
开发者ID:Azure,项目名称:azure-mobile-apps-net-client,代码行数:7,代码来源:PushUnit.Test.cs

示例5: RegisterAsync_ErrorHttp

 public async Task RegisterAsync_ErrorHttp()
 {
     MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri);
     var expectedUri = string.Format("{0}{1}/{2}", DefaultServiceUri, InstallationsPath, mobileClient.GetPush().InstallationId);
     var hijack = TestHttpDelegatingHandler.CreateTestHttpHandler(expectedUri, HttpMethod.Put, null, HttpStatusCode.BadRequest);
     mobileClient = new MobileServiceClient(DefaultServiceUri, hijack);
     var exception = await AssertEx.Throws<MobileServiceInvalidOperationException>(() => mobileClient.GetPush().RegisterAsync(this.registrationId));
     Assert.AreEqual(exception.Response.StatusCode, HttpStatusCode.BadRequest);
 }
开发者ID:Azure,项目名称:azure-mobile-apps-net-client,代码行数:9,代码来源:PushUnit.Test.cs

示例6: RegisterAsync_WithTemplates_TemplateBodyJSON

        public async Task RegisterAsync_WithTemplates_TemplateBodyJSON()
        {
            MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri);

            var expectedUri = string.Format("{0}{1}/{2}", DefaultServiceUri, InstallationsPath, mobileClient.GetPush().InstallationId);
            JObject templates = this.pushTestUtility.GetTemplates(true);
            string installationRegistration = JsonConvert.SerializeObject(this.pushTestUtility.GetInstallation(mobileClient.GetPush().InstallationId, true));
            var hijack = TestHttpDelegatingHandler.CreateTestHttpHandler(expectedUri, HttpMethod.Put, null, HttpStatusCode.OK, expectedRequestContent: installationRegistration);

            mobileClient = new MobileServiceClient(DefaultServiceUri, hijack);
            await mobileClient.GetPush().RegisterAsync(this.originalNSData, templates);
        }
开发者ID:Azure,项目名称:azure-mobile-apps-net-client,代码行数:12,代码来源:PushUnit.Test.cs


注:本文中的MobileServiceClient.GetPush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。