public async Task DeleteRegistration() { var expectedUri = string.Format("{0}{1}/{2}", DefaultServiceUri, RegistrationsPath, DefaultRegistrationId); var hijack = CreateTestHttpHandler(expectedUri, HttpMethod.Delete, null, HttpStatusCode.OK); MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri, null, hijack); var pushHttpClient = new PushHttpClient(mobileClient); // Because Unregistrer returns nothing, the only test we can perform is that the Http Method and body are correct // and that UnregisterAsync does not throw if Ok is returned await pushHttpClient.UnregisterAsync(DefaultRegistrationId); }
public async Task DeleteRegistration_Error() { var expectedUri = string.Format("{0}{1}/{2}", DefaultServiceUri, RegistrationsPath, DefaultRegistrationId); var hijack = CreateTestHttpHandler(expectedUri, HttpMethod.Delete, "\"Server threw 500\"", HttpStatusCode.InternalServerError); MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri, null, hijack); var pushHttpClient = new PushHttpClient(mobileClient); var exception = await AssertEx.Throws <MobileServiceInvalidOperationException>( () => pushHttpClient.UnregisterAsync(DefaultRegistrationId)); Assert.AreEqual(exception.Message, "Server threw 500"); }
public async Task DeleteRegistration_Error() { var expectedUri = string.Format("{0}{1}/{2}", DefaultServiceUri, RegistrationsPath, DefaultRegistrationId); var hijack = CreateTestHttpHandler(expectedUri, HttpMethod.Delete, "\"Server threw 500\"", HttpStatusCode.InternalServerError); MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri, null, hijack); var pushHttpClient = new PushHttpClient(mobileClient); var exception = await AssertEx.Throws<MobileServiceInvalidOperationException>( () => pushHttpClient.UnregisterAsync(DefaultRegistrationId)); Assert.AreEqual(exception.Message, "Server threw 500"); }