#include "yacppdic/container.hpp" #include "yacppdic/auto_wirable.hpp" #include "gtest/gtest.h" #include TEST(ContainerTest, BindAndGet) { auto container = yacppdic::DIContainer(); class IObject { public: virtual ~IObject() = default; virtual void destroy() = 0; virtual std::string_view name() = 0; }; class Object : public IObject, public yacppdic::AutoWirable { public: void destroy() {} std::string_view name() { return "A object"; } }; container.bind().to(); auto object = container.get(); EXPECT_EQ(object->name(), "A object"); auto object_two = container.get(); EXPECT_NE(object, object_two); }