Cleanup shutdown, activate and deactivate for MPSystemComponent
This commit is contained in:
@@ -35,14 +35,16 @@ namespace UnitTest
|
||||
|
||||
m_initHandler = Multiplayer::SessionInitEvent::Handler([this](AzNetworking::INetworkInterface* value) { TestInitEvent(value); });
|
||||
m_mpComponent->AddSessionInitHandler(m_initHandler);
|
||||
m_shutdownHandler = Multiplayer::SessionInitEvent::Handler([this](AzNetworking::INetworkInterface* value) { TestShutdownEvent(value); });
|
||||
m_shutdownHandler = Multiplayer::SessionShutdownEvent::Handler([this](AzNetworking::INetworkInterface* value) { TestShutdownEvent(value); });
|
||||
m_mpComponent->AddSessionShutdownHandler(m_shutdownHandler);
|
||||
m_connAcquiredHandler = Multiplayer::ConnectionAcquiredEvent::Handler([this](Multiplayer::MultiplayerAgentDatum value) { TestConnectionAcquiredEvent(value); });
|
||||
m_mpComponent->AddConnectionAcquiredHandler(m_connAcquiredHandler);
|
||||
m_mpComponent->Activate();
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
m_mpComponent->Deactivate();
|
||||
delete m_mpComponent;
|
||||
delete m_netComponent;
|
||||
AZ::NameDictionary::Destroy();
|
||||
@@ -86,6 +88,7 @@ namespace UnitTest
|
||||
|
||||
TEST_F(MultiplayerSystemTests, TestShutdownEvent)
|
||||
{
|
||||
m_mpComponent->InitializeMultiplayer(Multiplayer::MultiplayerAgentType::DedicatedServer);
|
||||
IMultiplayerConnectionMock connMock1 = IMultiplayerConnectionMock(AzNetworking::ConnectionId(), AzNetworking::IpAddress(), AzNetworking::ConnectionRole::Acceptor);
|
||||
IMultiplayerConnectionMock connMock2 = IMultiplayerConnectionMock(AzNetworking::ConnectionId(), AzNetworking::IpAddress(), AzNetworking::ConnectionRole::Connector);
|
||||
m_mpComponent->OnDisconnect(&connMock1, AzNetworking::DisconnectReason::None, AzNetworking::TerminationEndpoint::Local);
|
||||
|
||||
Reference in New Issue
Block a user