This library provides RLV command processing and ease of use for checking current RLV permissions and restrictions
61 lines
2.4 KiB
C#
61 lines
2.4 KiB
C#
using Moq;
|
|
|
|
namespace LibreMetaverse.RLV.Tests.Restrictions
|
|
{
|
|
public class AddAttachRestrictionTests : RestrictionsBase
|
|
{
|
|
#region @addattach[:<attach_point_name>]=<y/n>
|
|
[Fact]
|
|
public async Task AddAttach()
|
|
{
|
|
var sampleTree = SampleInventoryTree.BuildInventoryTree();
|
|
var sharedFolder = sampleTree.Root;
|
|
|
|
sampleTree.Root_Clothing_HappyShirt.AttachedTo = RlvAttachmentPoint.Chin;
|
|
sampleTree.Root_Clothing_HappyShirt.AttachedPrimId = new Guid("11111111-0001-4aaa-8aaa-ffffffffffff");
|
|
|
|
sampleTree.Root_Clothing_Hats_FancyHat_Chin.AttachedTo = RlvAttachmentPoint.Chin;
|
|
sampleTree.Root_Clothing_Hats_FancyHat_Chin.AttachedPrimId = new Guid("11111111-0003-4aaa-8aaa-ffffffffffff");
|
|
|
|
_queryCallbacks.Setup(e =>
|
|
e.TryGetSharedFolderAsync(default)
|
|
).ReturnsAsync((true, sharedFolder));
|
|
|
|
Assert.True(await _rlv.ProcessMessage("@addattach=n", _sender.Id, _sender.Name));
|
|
|
|
// #RLV/Clothing/Hats/Fancy Hat
|
|
Assert.False(_rlv.Permissions.CanAttach(sampleTree.Root_Clothing_Hats_FancyHat_Chin, true));
|
|
|
|
// #RLV/Clothing/Happy Shirt
|
|
Assert.False(_rlv.Permissions.CanAttach(sampleTree.Root_Clothing_HappyShirt, true));
|
|
}
|
|
|
|
[Fact]
|
|
public async Task AddAttach_Specific()
|
|
{
|
|
var sampleTree = SampleInventoryTree.BuildInventoryTree();
|
|
var sharedFolder = sampleTree.Root;
|
|
|
|
sampleTree.Root_Clothing_HappyShirt.AttachedTo = RlvAttachmentPoint.Groin;
|
|
sampleTree.Root_Clothing_HappyShirt.AttachedPrimId = new Guid("11111111-0001-4aaa-8aaa-ffffffffffff");
|
|
|
|
sampleTree.Root_Clothing_Hats_FancyHat_Chin.AttachedTo = RlvAttachmentPoint.Chin;
|
|
sampleTree.Root_Clothing_Hats_FancyHat_Chin.AttachedPrimId = new Guid("11111111-0003-4aaa-8aaa-ffffffffffff");
|
|
|
|
_queryCallbacks.Setup(e =>
|
|
e.TryGetSharedFolderAsync(default)
|
|
).ReturnsAsync((true, sharedFolder));
|
|
|
|
Assert.True(await _rlv.ProcessMessage("@addattach:groin=n", _sender.Id, _sender.Name));
|
|
|
|
// #RLV/Clothing/Hats/Fancy Hat
|
|
Assert.True(_rlv.Permissions.CanAttach(sampleTree.Root_Clothing_Hats_FancyHat_Chin, true));
|
|
|
|
// #RLV/Clothing/Happy Shirt
|
|
Assert.False(_rlv.Permissions.CanAttach(sampleTree.Root_Clothing_HappyShirt, true));
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
}
|