diff --git a/src/detail/pending-interest.hpp b/src/detail/pending-interest.hpp
index 791f59b..0a66dca 100644
--- a/src/detail/pending-interest.hpp
+++ b/src/detail/pending-interest.hpp
@@ -57,13 +57,13 @@
   }
 
   const shared_ptr<const Interest>&
-  getInterest()
+  getInterest() const
   {
     return m_interest;
   }
 
   const OnData&
-  getOnData()
+  getOnData() const
   {
     return m_onData;
   }
@@ -73,7 +73,7 @@
    * @return true if this interest timed out, otherwise false.
    */
   bool
-  isTimedOut(const time::steady_clock::TimePoint& now)
+  isTimedOut(const time::steady_clock::TimePoint& now) const
   {
     return now >= m_timeout;
   }
@@ -82,7 +82,7 @@
    * Call m_onTimeout (if defined).  This ignores exceptions from the m_onTimeout.
    */
   void
-  callTimeout()
+  callTimeout() const
   {
     if (m_onTimeout) {
       m_onTimeout(*m_interest);
@@ -114,7 +114,8 @@
   bool
   operator()(const shared_ptr<const PendingInterest>& pendingInterest) const
   {
-    return (reinterpret_cast<const PendingInterestId*>(pendingInterest.get()) == m_id);
+    return (reinterpret_cast<const PendingInterestId*>(
+              pendingInterest->getInterest().get()) == m_id);
   }
 private:
   const PendingInterestId* m_id;
diff --git a/src/face.cpp b/src/face.cpp
index 79d8dc1..42fc522 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -193,6 +193,12 @@
   m_ioService->post(bind(&Impl::asyncRemovePendingInterest, m_impl, pendingInterestId));
 }
 
+size_t
+Face::getNPendingInterests() const
+{
+  return m_impl->m_pendingInterestTable.size();
+}
+
 const RegisteredPrefixId*
 Face::setInterestFilter(const InterestFilter& interestFilter,
                         const OnInterest& onInterest,
diff --git a/src/face.hpp b/src/face.hpp
index 974aa69..3407d92 100644
--- a/src/face.hpp
+++ b/src/face.hpp
@@ -225,6 +225,12 @@
   removePendingInterest(const PendingInterestId* pendingInterestId);
 
   /**
+   * @brief Get number of pending Interests
+   */
+  size_t
+  getNPendingInterests() const;
+
+  /**
    * @brief Set InterestFilter to dispatch incoming matching interest to onInterest
    * callback and register the filtered prefix with the connected NDN forwarder
    *
diff --git a/tests/unit-tests/face.cpp b/tests/unit-tests/face.cpp
new file mode 100644
index 0000000..dcbff0b
--- /dev/null
+++ b/tests/unit-tests/face.cpp
@@ -0,0 +1,95 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2014 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "face.hpp"
+#include "security/key-chain.hpp"
+#include "dummy-client-face.hpp"
+
+#include "boost-test.hpp"
+
+namespace ndn {
+namespace tests {
+
+BOOST_AUTO_TEST_SUITE(TestsFace)
+
+class Fixture
+{
+public:
+  Fixture()
+    : face(makeDummyClientFace())
+    , nData(0)
+    , nTimeouts(0)
+  {
+  }
+
+  void
+  onData()
+  {
+    ++nData;
+  }
+
+  void
+  onTimeout()
+  {
+    ++nTimeouts;
+  }
+
+public:
+  shared_ptr<DummyClientFace> face;
+  uint32_t nData;
+  uint32_t nTimeouts;
+};
+
+BOOST_FIXTURE_TEST_CASE(ExpressInterest, Fixture)
+{
+  face->expressInterest(Interest("/test/interest", time::seconds(10)),
+                        bind(&Fixture::onData, this),
+                        bind(&Fixture::onTimeout, this));
+  face->processEvents(time::milliseconds(100));
+
+  BOOST_CHECK_EQUAL(face->m_sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(face->m_sentDatas.size(), 0);
+}
+
+BOOST_FIXTURE_TEST_CASE(RemovePendingInterest, Fixture)
+{
+  const PendingInterestId* interestId =
+    face->expressInterest(Interest("/test/interest", time::seconds(10)),
+                          bind(&Fixture::onData, this),
+                          bind(&Fixture::onTimeout, this));
+
+  shared_ptr<Data> data = make_shared<Data>("/test/interest/replied");
+  const uint8_t buffer[] = "Hello, world!";
+  data->setContent(buffer, sizeof(buffer));
+  KeyChain keyChain;
+  keyChain.sign(*data);
+  face->receive(*data);
+
+  face->removePendingInterest(interestId);
+  face->processEvents(time::milliseconds(100));
+  BOOST_CHECK_EQUAL(nData, 0);
+  BOOST_CHECK_EQUAL(nTimeouts, 0);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace ndn
