本文整理汇总了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);
}
示例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");
}
示例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");
}
示例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");
}
示例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);
}
示例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);
}