Exemplo n.º 1
0
        public void ShouldDeleteSenderId()
        {
            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 senderIdToDelete = new SenderId()
            {
                Id = senderId
            };

            client.DeleteSenderId(senderIdToDelete);

            mockClient.Verify(trc => trc.Execute<DeleteResult>(It.IsAny<IRestRequest>()), Times.Once);
            Assert.IsNotNull(savedRequest);
            Assert.AreEqual("senderids/{id}", savedRequest.Resource);
            Assert.AreEqual(Method.DELETE, savedRequest.Method);
            Assert.AreEqual(1, savedRequest.Parameters.Count);
            Assert.AreEqual(senderId.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.DeleteSenderId(senderIdToDelete);

            Assert.IsTrue(result.Success);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Delete a single Sender ID.
 /// </summary>
 /// <param name="senderId">SenderID object</param>
 /// <returns></returns>
 public DeleteResult DeleteSenderId(SenderId senderId)
 {
     return DeleteSenderId(senderId.Id);
 }