diff --git a/test/Signal/Signal.test.cpp b/test/Signal/Signal.test.cpp index a40c2669..55704090 100644 --- a/test/Signal/Signal.test.cpp +++ b/test/Signal/Signal.test.cpp @@ -12,22 +12,38 @@ namespace { } -TEST(Signal, ConnectEmitDisconnect) { - MockHandler handler{}; - auto delegate = NAS2D::Delegate{&handler, &MockHandler::MockMethod}; +TEST(Signal, InitEmpty) { NAS2D::Signal<> signal; - EXPECT_TRUE(signal.empty()); +} + +TEST(Signal, ConnectNonEmpty) { + NAS2D::Signal<> signal; + MockHandler handler{}; + auto delegate = NAS2D::Delegate{&handler, &MockHandler::MockMethod}; signal.connect(delegate); EXPECT_FALSE(signal.empty()); +} - EXPECT_CALL(handler, MockMethod()); - signal.emit(); +TEST(Signal, DisconnectEmpty) { + NAS2D::Signal<> signal; + MockHandler handler{}; + auto delegate = NAS2D::Delegate{&handler, &MockHandler::MockMethod}; + signal.connect(delegate); signal.disconnect(delegate); EXPECT_TRUE(signal.empty()); +} + +TEST(Signal, ConnectEmitDisconnect) { + NAS2D::Signal<> signal; + MockHandler handler{}; + auto delegate = NAS2D::Delegate{&handler, &MockHandler::MockMethod}; - EXPECT_CALL(handler, MockMethod()).Times(0); + EXPECT_CALL(handler, MockMethod()).Times(1); + signal.connect(delegate); + signal.emit(); + signal.disconnect(delegate); signal.emit(); }