From dcca1b8737fb8c388cc56449f1d01edb11fb64e5 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Wed, 26 Oct 2016 17:08:39 +0100 Subject: [PATCH] Added workshop publish tag tests --- Facepunch.Steamworks.Test/Client/Workshop.cs | 47 +++++++++++++++----- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/Facepunch.Steamworks.Test/Client/Workshop.cs b/Facepunch.Steamworks.Test/Client/Workshop.cs index 8c796b1..6139d81 100644 --- a/Facepunch.Steamworks.Test/Client/Workshop.cs +++ b/Facepunch.Steamworks.Test/Client/Workshop.cs @@ -373,21 +373,44 @@ namespace Facepunch.Steamworks.Test item.Title = "Facepunch.Steamworks Unit test"; item.Tags.Add( "Apple" ); item.Tags.Add( "Banana" ); - item.Publish(); - while ( item.Publishing ) + try { - client.Update(); - Thread.Sleep( 100 ); + item.Publish(); + + while ( item.Publishing ) + { + client.Update(); + Thread.Sleep( 100 ); + } + + Assert.IsFalse( item.Publishing ); + Assert.AreNotEqual( 0, item.Id ); + Assert.IsNull( item.Error ); + + Console.WriteLine( "item.Id: {0}", item.Id ); + + using ( var Query = client.Workshop.CreateQuery() ) + { + Query.FileId.Add( item.Id ); + Query.Run(); + + Query.Block(); + + var itemInfo = Query.Items[0]; + + Assert.AreEqual( itemInfo.Id, item.Id ); + Assert.AreEqual( itemInfo.OwnerId, client.SteamId ); + Assert.AreEqual( itemInfo.Title, item.Title ); + Assert.IsTrue( itemInfo.Tags.Contains( "Apple" ), "Missing Tag" ); + Assert.IsTrue( itemInfo.Tags.Contains( "Banana" ), "Missing Tag" ); + } + } + finally + { + Console.WriteLine( "Deleting: {0}", item.Id ); + item.Delete(); } - - Assert.IsFalse( item.Publishing ); - Assert.AreNotEqual( 0, item.Id ); - Assert.IsNull( item.Error ); - - Console.WriteLine( "item.Id: {0}", item.Id ); - - item.Delete(); } }