public async Task CreateRegistrationId() { var expectedUri = string.Format("{0}{1}", DefaultServiceUri, CreatePath); var hijack = CreateTestHttpHandler(expectedUri, HttpMethod.Post, null, HttpStatusCode.Created, LocationUri); MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri, null, hijack); var pushHttpClient = new PushHttpClient(mobileClient); var registrationId = await pushHttpClient.CreateRegistrationIdAsync(); Assert.AreEqual(registrationId, DefaultRegistrationId, "Expected CreateRegistrationIdAsync to return correct RegistrationId."); }
public async Task CreateRegistrationId_Error() { var expectedUri = string.Format("{0}{1}", DefaultServiceUri, CreatePath); var hijack = CreateTestHttpHandler(expectedUri, HttpMethod.Post, "\"Server threw 500\"", HttpStatusCode.InternalServerError, LocationUri); MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri, null, hijack); var pushHttpClient = new PushHttpClient(mobileClient); var exception = await AssertEx.Throws <MobileServiceInvalidOperationException>(() => pushHttpClient.CreateRegistrationIdAsync()); Assert.AreEqual(exception.Message, "Server threw 500"); }
public async Task CreateRegistrationId_Error() { var expectedUri = string.Format("{0}{1}", DefaultServiceUri, CreatePath); var hijack = CreateTestHttpHandler(expectedUri, HttpMethod.Post, "\"Server threw 500\"", HttpStatusCode.InternalServerError, LocationUri); MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri, null, hijack); var pushHttpClient = new PushHttpClient(mobileClient); var exception = await AssertEx.Throws<MobileServiceInvalidOperationException>(() => pushHttpClient.CreateRegistrationIdAsync()); Assert.AreEqual(exception.Message, "Server threw 500"); }