From 362ba26729f9a4f600e77d85f1e7e2563b5af151 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Wed, 1 May 2019 16:34:46 +0100 Subject: [PATCH] Chat test --- .../SteamMatchmakingTest.cs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Facepunch.Steamworks.Test/SteamMatchmakingTest.cs b/Facepunch.Steamworks.Test/SteamMatchmakingTest.cs index 484844f..abfe446 100644 --- a/Facepunch.Steamworks.Test/SteamMatchmakingTest.cs +++ b/Facepunch.Steamworks.Test/SteamMatchmakingTest.cs @@ -67,6 +67,39 @@ public async Task CreateLobby() lobby.SendChatString( "Hello I Love Lobbies" ); } + + [TestMethod] + public async Task LobbyChat() + { + SteamMatchmaking.OnChatMessage += ( lbby, member, message ) => + { + Console.WriteLine( $"[{lbby}] {member}: {message}" ); + }; + + var lobbyr = await SteamMatchmaking.CreateLobbyAsync( 10 ); + if ( !lobbyr.HasValue ) + Assert.Fail(); + + var lobby = lobbyr.Value; + lobby.SetPublic(); + lobby.SetData( "name", "Dave's Chat Room" ); + Console.WriteLine( $"lobby: {lobby.Id}" ); + + lobby.SendChatString( "Hello Friends, It's me - your big fat daddy" ); + + await Task.Delay( 50 ); + + lobby.SendChatString( "What? No love for daddy?" ); + + await Task.Delay( 500 ); + + lobby.SendChatString( "Okay I will LEAVE" ); + lobby.SendChatString( "BYE FOREVER" ); + + await Task.Delay( 1000 ); + + lobby.Leave(); + } } }