public void ShouldCancelDedicatedNumber() { IRestRequest savedRequest = null; mockClient.Setup(trc => trc.Execute <DeleteResult>(It.IsAny <IRestRequest>())) .Callback <IRestRequest>(request => savedRequest = request) .Returns(new DeleteResult()); var client = mockClient.Object; var DedicatedNumberToCancel = new DedicatedNumber { Id = 12345 }; client.CancelDedicatedNumber(DedicatedNumberToCancel); mockClient.Verify(trc => trc.Execute <DeleteResult>(It.IsAny <IRestRequest>()), Times.Once); Assert.IsNotNull(savedRequest); Assert.AreEqual("numbers/{id}", savedRequest.Resource); Assert.AreEqual(Method.DELETE, savedRequest.Method); Assert.AreEqual(1, savedRequest.Parameters.Count); Assert.AreEqual(DedicatedNumberToCancel.Id.ToString(), savedRequest.Parameters.Find(x => x.Name == "id").Value); var content = "{}"; var testClient = Common.CreateClient <DeleteResult>(content, null, null); client = new Client(testClient); var result = client.CancelDedicatedNumber(DedicatedNumberToCancel); Assert.IsTrue(result.Success); }
/// <summary> /// Cancel dedicated number subscription. /// </summary> /// <param name="senderId">DedicatedNumber object</param> /// <returns></returns> public DeleteResult CancelDedicatedNumber(DedicatedNumber number) { return(CancelDedicatedNumber(number.Id)); }