Add initial unit tests

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: Id4850e52073ea6780a978c6cd5a5c439aa8ed846
diff --git a/test/mocked_sdbus.cpp b/test/mocked_sdbus.cpp
new file mode 100644
index 0000000..0d81853
--- /dev/null
+++ b/test/mocked_sdbus.cpp
@@ -0,0 +1,26 @@
+#include "sdbus_wrapper.hpp"
+
+#include <sdbusplus/test/sdbus_mock.hpp>
+
+#include <memory>
+
+// To support ipmid_get_sd_bus_connection, we have to make the sdbusMock global
+static std::unique_ptr<sdbusplus::SdBusMock> sdbusMock;
+static std::unique_ptr<sdbusplus::bus::bus> mockedBus;
+
+sdbusplus::bus::bus& getBus()
+{
+    if (!sdbusMock)
+    {
+        sdbusMock = std::make_unique<sdbusplus::SdBusMock>();
+    }
+    mockedBus = std::make_unique<sdbusplus::bus::bus>(
+        sdbusplus::get_mocked_new(sdbusMock.get()));
+    return *mockedBus.get();
+}
+
+void clearMockedBus()
+{
+    sdbusMock.reset();
+    mockedBus.reset();
+}