Files
libremetaverse/LibreMetaverse.RLV.Tests/Restrictions/RemAttachRestrictionTests.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

97 lines
3.5 KiB
C#

using Moq;
namespace LibreMetaverse.RLV.Tests.Restrictions
{
public class RemAttachRestrictionTests : RestrictionsBase
{
#region @remattach[:<attach_point_name>]=<y/n>
[Fact]
public async Task RemAttach()
{
// #RLV
// |
// |- .private
// |
// |- Clothing
// | |= Business Pants
// | |= Happy Shirt
// | |= Retro Pants
// | \- Hats
// | |
// | |- Sub Hats
// | | \ (Empty)
// | |
// | |= Fancy Hat (Attached to Chin)
// | \= Party Hat
// \-Accessories
// |= Watch (Worn as Tattoo)
// \= Glasses
//
var sampleTree = SampleInventoryTree.BuildInventoryTree();
var sharedFolder = sampleTree.Root;
sampleTree.Root_Clothing_Hats_FancyHat_Chin.AttachedTo = RlvAttachmentPoint.Chin;
sampleTree.Root_Clothing_Hats_FancyHat_Chin.AttachedPrimId = new Guid("11111111-0003-4aaa-8aaa-ffffffffffff");
sampleTree.Root_Accessories_Watch.WornOn = RlvWearableType.Tattoo;
_queryCallbacks.Setup(e =>
e.TryGetSharedFolderAsync(default)
).ReturnsAsync((true, sharedFolder));
Assert.True(await _rlv.ProcessMessage("@remattach=n", _sender.Id, _sender.Name));
Assert.False(_rlv.Permissions.CanDetach(sampleTree.Root_Clothing_Hats_FancyHat_Chin, true));
Assert.True(_rlv.Permissions.CanDetach(sampleTree.Root_Accessories_Watch, true));
}
[Fact]
public async Task RemAttach_Specific()
{
// #RLV
// |
// |- .private
// |
// |- Clothing
// | |= Business Pants
// | |= Happy Shirt
// | |= Retro Pants
// | \- Hats
// | |
// | |- Sub Hats
// | | \ (Empty)
// | |
// | |= Fancy Hat (Attached to Chin)
// | \= Party Hat
// \-Accessories
// |= Watch (Worn as Tattoo)
// \= Glasses
//
var sampleTree = SampleInventoryTree.BuildInventoryTree();
var sharedFolder = sampleTree.Root;
sampleTree.Root_Clothing_Hats_PartyHat_Spine.AttachedTo = RlvAttachmentPoint.Spine;
sampleTree.Root_Clothing_Hats_PartyHat_Spine.AttachedPrimId = new Guid("11111111-0003-4aaa-8aaa-ffffffffffff");
sampleTree.Root_Clothing_Hats_FancyHat_Chin.AttachedTo = RlvAttachmentPoint.Chin;
sampleTree.Root_Clothing_Hats_FancyHat_Chin.AttachedPrimId = new Guid("11111111-0002-4aaa-8aaa-ffffffffffff");
sampleTree.Root_Accessories_Watch.WornOn = RlvWearableType.Tattoo;
_queryCallbacks.Setup(e =>
e.TryGetSharedFolderAsync(default)
).ReturnsAsync((true, sharedFolder));
Assert.True(await _rlv.ProcessMessage("@remattach:spine=n", _sender.Id, _sender.Name));
Assert.False(_rlv.Permissions.CanDetach(sampleTree.Root_Clothing_Hats_PartyHat_Spine, true));
Assert.True(_rlv.Permissions.CanDetach(sampleTree.Root_Clothing_Hats_FancyHat_Chin, true));
Assert.True(_rlv.Permissions.CanDetach(sampleTree.Root_Accessories_Watch, true));
}
#endregion
}
}