public void ShouldDeleteSession() { 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 session = new Session() { Id = sessionId }; client.DeleteSession(session); mockClient.Verify(trc => trc.Execute<DeleteResult>(It.IsAny<IRestRequest>()), Times.Once); Assert.IsNotNull(savedRequest); Assert.AreEqual("sessions/{id}", savedRequest.Resource); Assert.AreEqual(Method.DELETE, savedRequest.Method); Assert.AreEqual(1, savedRequest.Parameters.Count); Assert.AreEqual(sessionId.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.DeleteSession(session); Assert.IsTrue(result.Success); }