RequireAllTags test

This commit is contained in:
Garry Newman 2016-10-10 15:46:56 +01:00
parent dfbbaaae47
commit e668b7ff04
2 changed files with 39 additions and 1 deletions

View File

@ -95,6 +95,44 @@ public void QueryTagRequire()
}
}
[TestMethod]
public void QueryTagRequireMultiple()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
using ( var Query = client.Workshop.CreateQuery() )
{
Query.RequireTags.Add( "LongTShirt Skin" );
Query.RequireTags.Add( "version2" );
Query.RequireAllTags = true;
Query.Run();
Query.Block();
Assert.IsFalse( Query.IsRunning );
Assert.IsTrue( Query.TotalResults > 0 );
Assert.IsTrue( Query.Items.Length > 0 );
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
Assert.IsTrue( Query.TotalResults > 0 );
Assert.IsTrue( Query.Items.Length > 0 );
foreach ( var item in Query.Items )
{
Console.WriteLine( "{0}", item.Title );
Console.WriteLine( "\t{0}", string.Join( ";", item.Tags ) );
Assert.IsTrue( item.Tags.Contains( "LongTShirt Skin" ) );
Assert.IsTrue( item.Tags.Contains( "version2" ) );
}
}
}
}
[TestMethod]
public void QueryTagExclude()
{

View File

@ -73,7 +73,7 @@ public unsafe void Run()
workshop.ugc.AddRequiredTag( Handle, tag );
if ( RequireTags.Count > 0 )
workshop.ugc.SetMatchAnyTag( Handle, RequireAllTags );
workshop.ugc.SetMatchAnyTag( Handle, !RequireAllTags );
foreach ( var tag in ExcludeTags )
workshop.ugc.AddExcludedTag( Handle, tag );