public void ShouldDeleteSchedule() { 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 schedule = new Schedule() { Id = scheduleId }; client.DeleteSchedule(schedule); mockClient.Verify(trc => trc.Execute<DeleteResult>(It.IsAny<IRestRequest>()), Times.Once); Assert.IsNotNull(savedRequest); Assert.AreEqual("schedules/{id}", savedRequest.Resource); Assert.AreEqual(Method.DELETE, savedRequest.Method); Assert.AreEqual(1, savedRequest.Parameters.Count); Assert.AreEqual(scheduleId.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.DeleteSchedule(schedule); Assert.IsTrue(result.Success); }