Files
libremetaverse/LibreMetaverse.RLV.Tests/Queries/FindFoldersQueryTests.cs
nooperation d905210ecf Initial commit of LibreMetaverse.RLV and LibreMetaverse.RLV.Tests.
This library provides RLV command processing and ease of use for checking current RLV permissions and restrictions
2025-08-17 19:55:33 -04:00

89 lines
3.0 KiB
C#

using Moq;
namespace LibreMetaverse.RLV.Tests.Queries
{
public class FindFoldersQueryTests : RestrictionsBase
{
#region @findfolders:part1[&&...&&partN][;output_separator]=<channel_number>
[Fact]
public async Task FindFolders()
{
// #RLV
// |
// |- .private
// |
// |- Clothing
// | |= Business Pants (attached to 'groin')
// | |= Happy Shirt (attached to 'chest')
// | |= Retro Pants (worn on 'pants')
// | \-Hats
// | |
// | |- Sub Hats
// | | \ (Empty)
// | |
// | |= Fancy Hat (attached to 'chin')
// | \= Party Hat (attached to 'groin')
// \-Accessories
// |= Watch (worn on 'tattoo')
// \= Glasses (attached to 'chin')
var actual = _actionCallbacks.RecordReplies();
var sampleTree = SampleInventoryTree.BuildInventoryTree();
var sharedFolder = sampleTree.Root;
_queryCallbacks.Setup(e =>
e.TryGetSharedFolderAsync(default)
).ReturnsAsync((true, sharedFolder));
var expected = new List<(int Channel, string Text)>
{
(1234, "Clothing/Hats,Clothing/Hats/Sub Hats"),
};
Assert.True(await _rlv.ProcessMessage("@findfolders:at=1234", _sender.Id, _sender.Name));
Assert.Equal(expected, actual);
}
[Fact]
public async Task FindFolders_Separator()
{
// #RLV
// |
// |- .private
// |
// |- Clothing
// | |= Business Pants (attached to 'groin')
// | |= Happy Shirt (attached to 'chest')
// | |= Retro Pants (worn on 'pants')
// | \-Hats
// | |
// | |- Sub Hats
// | | \ (Empty)
// | |
// | |= Fancy Hat (attached to 'chin')
// | \= Party Hat (attached to 'groin')
// \-Accessories
// |= Watch (worn on 'tattoo')
// \= Glasses (attached to 'chin')
var actual = _actionCallbacks.RecordReplies();
var sampleTree = SampleInventoryTree.BuildInventoryTree();
var sharedFolder = sampleTree.Root;
_queryCallbacks.Setup(e =>
e.TryGetSharedFolderAsync(default)
).ReturnsAsync((true, sharedFolder));
var expected = new List<(int Channel, string Text)>
{
(1234, "Clothing/Hats AND Clothing/Hats/Sub Hats"),
};
Assert.True(await _rlv.ProcessMessage("@findfolders:at; AND =1234", _sender.Id, _sender.Name));
Assert.Equal(expected, actual);
}
#endregion
}
}