diff --git a/tests/daemon/face/dummy-lp-face.cpp b/tests/daemon/face/dummy-lp-face.cpp
new file mode 100644
index 0000000..20fb20d
--- /dev/null
+++ b/tests/daemon/face/dummy-lp-face.cpp
@@ -0,0 +1,140 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "dummy-lp-face.hpp"
+#include "dummy-transport.hpp"
+
+namespace nfd {
+namespace face {
+namespace tests {
+
+class DummyLpFace::LinkService : public face::LinkService
+{
+public:
+  void
+  receiveInterest(const Interest& interest)
+  {
+    this->face::LinkService::receiveInterest(interest);
+  }
+
+  void
+  receiveData(const Data& data)
+  {
+    this->face::LinkService::receiveData(data);
+  }
+
+  void
+  receiveNack(const lp::Nack& nack)
+  {
+    this->face::LinkService::receiveNack(nack);
+  }
+
+  signal::Signal<LinkService> afterSend;
+
+private:
+  virtual void
+  doSendInterest(const Interest& interest) DECL_OVERRIDE
+  {
+    this->sentInterests.push_back(interest);
+    this->afterSend();
+  }
+
+  virtual void
+  doSendData(const Data& data) DECL_OVERRIDE
+  {
+    this->sentData.push_back(data);
+    this->afterSend();
+  }
+
+  virtual void
+  doSendNack(const lp::Nack& nack) DECL_OVERRIDE
+  {
+    this->sentNacks.push_back(nack);
+    this->afterSend();
+  }
+
+  virtual void
+  doReceivePacket(Transport::Packet&& packet) DECL_OVERRIDE
+  {
+    BOOST_ASSERT(false);
+  }
+
+public:
+  std::vector<Interest> sentInterests;
+  std::vector<Data> sentData;
+  std::vector<lp::Nack> sentNacks;
+};
+
+DummyLpFace::DummyLpFace(const std::string& localUri, const std::string& remoteUri,
+                         ndn::nfd::FaceScope scope, ndn::nfd::FacePersistency persistency,
+                         ndn::nfd::LinkType linkType)
+  : LpFace(make_unique<LinkService>(),
+           make_unique<DummyTransport>(localUri, remoteUri, scope, persistency, linkType))
+  , afterSend(this->getLinkServiceInternal()->afterSend)
+  , sentInterests(this->getLinkServiceInternal()->sentInterests)
+  , sentData(this->getLinkServiceInternal()->sentData)
+  , sentNacks(this->getLinkServiceInternal()->sentNacks)
+{
+}
+
+void
+DummyLpFace::setState(FaceState state)
+{
+  this->getTransportInternal()->setState(state);
+}
+
+void
+DummyLpFace::receiveInterest(const Interest& interest)
+{
+  this->getLinkServiceInternal()->receiveInterest(interest);
+}
+
+void
+DummyLpFace::receiveData(const Data& data)
+{
+  this->getLinkServiceInternal()->receiveData(data);
+}
+
+void
+DummyLpFace::receiveNack(const lp::Nack& nack)
+{
+  this->getLinkServiceInternal()->receiveNack(nack);
+}
+
+DummyLpFace::LinkService*
+DummyLpFace::getLinkServiceInternal()
+{
+  return static_cast<LinkService*>(this->getLinkService());
+}
+
+DummyTransport*
+DummyLpFace::getTransportInternal()
+{
+  return static_cast<DummyTransport*>(this->getTransport());
+}
+
+} // namespace tests
+} // namespace face
+} // namespace nfd
diff --git a/tests/daemon/face/dummy-lp-face.hpp b/tests/daemon/face/dummy-lp-face.hpp
new file mode 100644
index 0000000..588cb59
--- /dev/null
+++ b/tests/daemon/face/dummy-lp-face.hpp
@@ -0,0 +1,99 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_TESTS_DAEMON_FACE_DUMMY_LP_FACE_HPP
+#define NFD_TESTS_DAEMON_FACE_DUMMY_LP_FACE_HPP
+
+#include "face/lp-face.hpp"
+
+namespace nfd {
+namespace face {
+namespace tests {
+
+class DummyTransport;
+
+/** \brief a LpFace for unit testing
+ *
+ *  The DummyLpFace allows observing outgoing network-layer packets,
+ *  and allows incoming network-layer packets to be injected from a test suite.
+ *  It's primarily used for forwarding test suites, but can be used in other tests as well.
+ */
+class DummyLpFace : public LpFace
+{
+public:
+  class LinkService;
+
+  DummyLpFace(const std::string& localUri = "dummy://", const std::string& remoteUri = "dummy://",
+              ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_NON_LOCAL,
+              ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+              ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_POINT_TO_POINT);
+
+  /** \brief changes face state
+   *  \pre current state is not CLOSED or FAILED
+   */
+  void
+  setState(FaceState state);
+
+  /** \brief causes the face to receive an Interest
+   */
+  void
+  receiveInterest(const Interest& interest);
+
+  /** \brief causes the face to receive a Data
+   */
+  void
+  receiveData(const Data& data);
+
+  /** \brief causes the face to receive a Nack
+   */
+  void
+  receiveNack(const lp::Nack& nack);
+
+  /** \brief signals after any network-layer packet is sent
+   */
+  signal::Signal<LinkService>& afterSend;
+
+private:
+  LinkService*
+  getLinkServiceInternal();
+
+  DummyTransport*
+  getTransportInternal();
+
+public:
+  std::vector<Interest>& sentInterests;
+  std::vector<Data>& sentData;
+  std::vector<lp::Nack>& sentNacks;
+};
+
+} // namespace tests
+} // namespace face
+
+namespace tests {
+using nfd::face::tests::DummyLpFace;
+} // namespace tests
+} // namespace nfd
+
+#endif // NFD_TESTS_DAEMON_FACE_DUMMY_LP_FACE_HPP
diff --git a/tests/daemon/face/dummy-transport.hpp b/tests/daemon/face/dummy-transport.hpp
new file mode 100644
index 0000000..df8fa54
--- /dev/null
+++ b/tests/daemon/face/dummy-transport.hpp
@@ -0,0 +1,96 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_TESTS_DAEMON_FACE_DUMMY_TRANSPORT_HPP
+#define NFD_TESTS_DAEMON_FACE_DUMMY_TRANSPORT_HPP
+
+#include "common.hpp"
+
+#include "face/transport.hpp"
+
+namespace nfd {
+namespace face {
+namespace tests {
+
+/** \brief dummy Transport used in unit tests
+ */
+class DummyTransport : public Transport
+{
+public:
+  DummyTransport(const std::string& localUri = "dummy://",
+                 const std::string& remoteUri = "dummy://",
+                 ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_NON_LOCAL,
+                 ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                 ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_POINT_TO_POINT)
+    : isClosed(false)
+  {
+    this->setLocalUri(FaceUri(localUri));
+    this->setRemoteUri(FaceUri(remoteUri));
+    this->setScope(scope);
+    this->setPersistency(persistency);
+    this->setLinkType(linkType);
+  }
+
+  void
+  setState(FaceState state)
+  {
+    this->Transport::setState(state);
+  }
+
+  void
+  receivePacket(Packet&& packet)
+  {
+    this->receive(std::move(packet));
+  }
+
+  void
+  receivePacket(Block block)
+  {
+    this->receive(Packet(std::move(block)));
+  }
+
+private:
+  virtual void
+  doClose() DECL_OVERRIDE
+  {
+    isClosed = true;
+  }
+
+  virtual void
+  doSend(Packet&& packet) DECL_OVERRIDE
+  {
+    sentPackets.push_back(std::move(packet));
+  }
+
+public:
+  bool isClosed;
+  std::vector<Packet> sentPackets;
+};
+
+} // namespace tests
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_TESTS_DAEMON_FACE_DUMMY_TRANSPORT_HPP
diff --git a/tests/daemon/face/generic-link-service.t.cpp b/tests/daemon/face/generic-link-service.t.cpp
new file mode 100644
index 0000000..a918b26
--- /dev/null
+++ b/tests/daemon/face/generic-link-service.t.cpp
@@ -0,0 +1,285 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "face/generic-link-service.hpp"
+#include "face/lp-face.hpp"
+#include "dummy-transport.hpp"
+
+#include "tests/test-common.hpp"
+
+namespace nfd {
+namespace face {
+namespace tests {
+
+using namespace nfd::tests;
+
+BOOST_AUTO_TEST_SUITE(Face)
+
+class GenericLinkServiceFixture : public BaseFixture
+{
+protected:
+  GenericLinkServiceFixture()
+    : service(nullptr)
+    , transport(nullptr)
+  {
+    this->initialize();
+    // By default, GenericLinkService is created with default options.
+    // Test cases may invoke .initialize with alternate options.
+  }
+
+  void
+  initialize()
+  {
+    // TODO#3104 add GenericLinkService::Options parameter,
+    //           and create GenericLinkService with options
+    face.reset(new LpFace(make_unique<GenericLinkService>(),
+                          make_unique<DummyTransport>()));
+    service = static_cast<GenericLinkService*>(face->getLinkService());
+    transport = static_cast<DummyTransport*>(face->getTransport());
+
+    face->afterReceiveInterest.connect(
+      [this] (const Interest& interest) { receivedInterests.push_back(interest); });
+    face->afterReceiveData.connect(
+      [this] (const Data& data) { receivedData.push_back(data); });
+    face->afterReceiveNack.connect(
+      [this] (const lp::Nack& nack) { receivedNacks.push_back(nack); });
+  }
+
+protected:
+  unique_ptr<LpFace> face;
+  GenericLinkService* service;
+  DummyTransport* transport;
+  std::vector<Interest> receivedInterests;
+  std::vector<Data> receivedData;
+  std::vector<lp::Nack> receivedNacks;
+};
+
+BOOST_FIXTURE_TEST_SUITE(TestGenericLinkService, GenericLinkServiceFixture)
+
+
+BOOST_AUTO_TEST_SUITE(SimpleSendReceive) // send and receive without other fields
+
+BOOST_AUTO_TEST_CASE(SendInterest)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  shared_ptr<Interest> interest1 = makeInterest("/localhost/test");
+
+  face->sendInterest(*interest1);
+
+  BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1);
+  BOOST_CHECK(transport->sentPackets.back().packet == interest1->wireEncode());
+}
+
+BOOST_AUTO_TEST_CASE(SendData)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  shared_ptr<Data> data1 = makeData("/localhost/test");
+
+  face->sendData(*data1);
+
+  BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1);
+  BOOST_CHECK(transport->sentPackets.back().packet == data1->wireEncode());
+}
+
+BOOST_AUTO_TEST_CASE(SendNack)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  lp::Nack nack1 = makeNack("/localhost/test", 323, lp::NackReason::NO_ROUTE);
+
+  face->sendNack(nack1);
+
+  BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1);
+  lp::Packet nack1pkt;
+  BOOST_REQUIRE_NO_THROW(nack1pkt.wireDecode(transport->sentPackets.back().packet));
+  BOOST_CHECK_EQUAL(nack1pkt.has<lp::NackField>(), true);
+  BOOST_CHECK_EQUAL(nack1pkt.has<lp::FragmentField>(), true);
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveBareInterest)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  shared_ptr<Interest> interest1 = makeInterest("/23Rd9hEiR");
+
+  transport->receivePacket(interest1->wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
+  BOOST_CHECK_EQUAL(receivedInterests.back(), *interest1);
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveInterest)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  shared_ptr<Interest> interest1 = makeInterest("/23Rd9hEiR");
+  lp::Packet lpPacket;
+  lpPacket.set<lp::FragmentField>(std::make_pair(
+    interest1->wireEncode().begin(), interest1->wireEncode().end()));
+  lpPacket.set<lp::SequenceField>(0); // force LpPacket encoding
+
+  transport->receivePacket(lpPacket.wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
+  BOOST_CHECK_EQUAL(receivedInterests.back(), *interest1);
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveBareData)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  shared_ptr<Data> data1 = makeData("/12345678");
+
+  transport->receivePacket(data1->wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedData.size(), 1);
+  BOOST_CHECK_EQUAL(receivedData.back(), *data1);
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveData)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  shared_ptr<Data> data1 = makeData("/12345689");
+  lp::Packet lpPacket;
+  lpPacket.set<lp::FragmentField>(std::make_pair(
+    data1->wireEncode().begin(), data1->wireEncode().end()));
+  lpPacket.set<lp::SequenceField>(0); // force LpPacket encoding
+
+  transport->receivePacket(lpPacket.wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedData.size(), 1);
+  BOOST_CHECK_EQUAL(receivedData.back(), *data1);
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveNack)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  lp::Nack nack1 = makeNack("/localhost/test", 323, lp::NackReason::NO_ROUTE);
+  lp::Packet lpPacket;
+  lpPacket.set<lp::FragmentField>(std::make_pair(
+    nack1.getInterest().wireEncode().begin(), nack1.getInterest().wireEncode().end()));
+  lpPacket.set<lp::NackField>(nack1.getHeader());
+
+  transport->receivePacket(lpPacket.wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedNacks.size(), 1);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // SimpleSendReceive
+
+
+BOOST_AUTO_TEST_SUITE(LocalFields)
+
+BOOST_AUTO_TEST_CASE(SendIncomingFaceId)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 send Interest with IncomingFaceId
+  //           expect transport->sentPackets.back() has IncomingFaceId field
+}
+
+BOOST_AUTO_TEST_CASE(SendIncomingFaceIdDisabled)
+{
+  // TODO#3104 initialize with Options that disables local fields
+  // TODO#3104 send Interest with IncomingFaceId
+  //           expect transport->sentPackets.back() has no IncomingFaceId field
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveIncomingFaceIdIgnore)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Interest with IncomingFaceId
+  //           expect receivedInterests.back() has no IncomingFaceId tag
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveNextHopFaceId)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Interest with NextHopFaceId
+  //           expect receivedInterests.back() has NextHopFaceId tag
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveNextHopFaceIdDisabled)
+{
+  // TODO#3104 initialize with Options that disables local fields
+  // TODO#3104 receive Interest with NextHopFaceId
+  //           expect receivedInterests.empty()
+  //       or, expect receivedInterests.back() has no NextHopFaceId tag
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveNextHopFaceIdDropData)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Data with NextHopFaceId
+  //           expect receivedData.empty()
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveNextHopFaceIdDropNack)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Nack with NextHopFaceId
+  //           expect receivedNacks.empty()
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveCacheControl)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Data with CacheControl
+  //           expect receivedData.back() has CacheControl tag
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveCacheControlDisabled)
+{
+  // TODO#3104 initialize with Options that disables local fields
+  // TODO#3104 receive Data with CacheControl
+  //           expect receivedData.back() has no CacheControl tag
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveCacheControlDropInterest)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Interest with CacheControl
+  //           expect receivedInterests.empty()
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveCacheControlDropNack)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Nack with CacheControl
+  //           expect receivedNacks.empty()
+}
+
+BOOST_AUTO_TEST_SUITE_END() // LocalFields
+
+
+BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace face
+} // namespace nfd
diff --git a/tests/daemon/face/lp-face-wrapper.t.cpp b/tests/daemon/face/lp-face-wrapper.t.cpp
new file mode 100644
index 0000000..182d2fc
--- /dev/null
+++ b/tests/daemon/face/lp-face-wrapper.t.cpp
@@ -0,0 +1,173 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "face/lp-face-wrapper.hpp"
+#include "fw/forwarder.hpp"
+
+#include "tests/test-common.hpp"
+#include "dummy-lp-face.hpp"
+
+namespace nfd {
+namespace face {
+namespace tests {
+
+using namespace nfd::tests;
+
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestLpFaceWrapper, BaseFixture)
+
+BOOST_AUTO_TEST_CASE(SetId)
+{
+  Forwarder forwarder;
+  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
+  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
+
+  BOOST_CHECK_EQUAL(face1->getId(), nfd::face::INVALID_FACEID);
+  BOOST_CHECK_EQUAL(face1w->getId(), nfd::INVALID_FACEID);
+
+  forwarder.addFace(face1w);
+
+  BOOST_CHECK_NE(face1->getId(), nfd::face::INVALID_FACEID);
+  BOOST_CHECK_NE(face1w->getId(), nfd::INVALID_FACEID);
+  BOOST_CHECK_EQUAL(face1->getId(), static_cast<face::FaceId>(face1w->getId()));
+}
+
+BOOST_AUTO_TEST_CASE(SetPersistency)
+{
+  unique_ptr<LpFace> face1u = make_unique<DummyLpFace>();
+  face1u->setPersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
+
+  auto face1w = make_shared<face::LpFaceWrapper>(std::move(face1u));
+  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
+
+  BOOST_CHECK_EQUAL(face1->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
+  BOOST_CHECK_EQUAL(face1w->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
+
+  face1w->setPersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT);
+
+  BOOST_CHECK_EQUAL(face1->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT);
+  BOOST_CHECK_EQUAL(face1w->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT);
+}
+
+BOOST_AUTO_TEST_CASE(FailSignal)
+{
+  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
+  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
+
+  bool isFailed = false;
+  face1w->onFail.connect(bind([&isFailed] { isFailed = true; }));
+
+  face1->setState(FaceState::DOWN);
+  BOOST_CHECK(!isFailed);
+
+  face1->setState(FaceState::FAILED);
+  BOOST_CHECK(!isFailed);
+
+  face1->setState(FaceState::CLOSED);
+  BOOST_CHECK(isFailed);
+}
+
+BOOST_AUTO_TEST_CASE(SendReceive)
+{
+  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
+  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
+
+  const size_t nInInterests = 192;
+  const size_t nInData = 91;
+  const size_t nInNacks = 29;
+  const size_t nOutInterests = 202;
+  const size_t nOutData = 128;
+  const size_t nOutNacks = 84;
+
+  size_t nReceivedInterests = 0;
+  size_t nReceivedData = 0;
+  size_t nReceivedNacks = 0;
+  face1w->onReceiveInterest.connect(bind([&nReceivedInterests] { ++nReceivedInterests; }));
+  face1w->onReceiveData.connect(bind([&nReceivedData] { ++nReceivedData; }));
+  face1w->onReceiveNack.connect(bind([&nReceivedNacks] { ++nReceivedNacks; }));
+
+  BOOST_CHECK_EQUAL(face1->getCounters().getNInInterests(), 0);
+  BOOST_CHECK_EQUAL(face1->getCounters().getNInDatas(), 0);
+  BOOST_CHECK_EQUAL(face1->getCounters().getNOutInterests(), 0);
+  BOOST_CHECK_EQUAL(face1->getCounters().getNOutDatas(), 0);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNInInterests(), 0);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNInDatas(), 0);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNOutInterests(), 0);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNOutDatas(), 0);
+  // There's no counters for NACK for now.
+
+  for (size_t i = 0; i < nInInterests; ++i) {
+    shared_ptr<Interest> interest = makeInterest("/JSQdqward4");
+    face1->receiveInterest(*interest);
+  }
+
+  for (size_t i = 0; i < nInData; ++i) {
+    shared_ptr<Data> data = makeData("/hT8FDigWn1");
+    face1->receiveData(*data);
+  }
+
+  for (size_t i = 0; i < nInNacks; ++i) {
+    lp::Nack nack = makeNack("/StnEVTj4Ex", 561, lp::NackReason::CONGESTION);
+    face1->receiveNack(nack);
+  }
+
+  for (size_t i = 0; i < nOutInterests; ++i) {
+    shared_ptr<Interest> interest = makeInterest("/XyUAFYQDmd");
+    face1w->sendInterest(*interest);
+  }
+
+  for (size_t i = 0; i < nOutData; ++i) {
+    shared_ptr<Data> data = makeData("/GigPEtPH6");
+    face1w->sendData(*data);
+  }
+
+  for (size_t i = 0; i < nOutNacks; ++i) {
+    lp::Nack nack = makeNack("/9xK6FbwIBM", 365, lp::NackReason::CONGESTION);
+    face1w->sendNack(nack);
+  }
+
+  BOOST_CHECK_EQUAL(face1->getCounters().getNInInterests(), nInInterests);
+  BOOST_CHECK_EQUAL(face1->getCounters().getNInDatas(), nInData);
+  BOOST_CHECK_EQUAL(face1->getCounters().getNOutInterests(), nOutInterests);
+  BOOST_CHECK_EQUAL(face1->getCounters().getNOutDatas(), nOutData);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNInInterests(), nInInterests);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNInDatas(), nInData);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNOutInterests(), nOutInterests);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNOutDatas(), nOutData);
+
+  BOOST_CHECK_EQUAL(nReceivedInterests, nInInterests);
+  BOOST_CHECK_EQUAL(nReceivedData, nInData);
+  BOOST_CHECK_EQUAL(nReceivedNacks, nInNacks);
+  BOOST_CHECK_EQUAL(face1->sentInterests.size(), nOutInterests);
+  BOOST_CHECK_EQUAL(face1->sentData.size(), nOutData);
+  BOOST_CHECK_EQUAL(face1->sentNacks.size(), nOutNacks);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace face
+} // namespace nfd
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 784ee2d..c7b7c36 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -135,9 +135,13 @@
 };
 
 inline shared_ptr<Interest>
-makeInterest(const Name& name)
+makeInterest(const Name& name, uint32_t nonce = 0)
 {
-  return make_shared<Interest>(name);
+  auto interest = make_shared<Interest>(name);
+  if (nonce != 0) {
+    interest->setNonce(nonce);
+  }
+  return interest;
 }
 
 inline shared_ptr<Data>
@@ -166,6 +170,16 @@
   return link;
 }
 
+inline lp::Nack
+makeNack(const Name& name, uint32_t nonce, lp::NackReason reason)
+{
+  Interest interest(name);
+  interest.setNonce(nonce);
+  lp::Nack nack(std::move(interest));
+  nack.setReason(reason);
+  return nack;
+}
+
 } // namespace tests
 } // namespace nfd
 
