using Moq; namespace LibreMetaverse.RLV.Tests.Restrictions { public class AddAttachRestrictionTests : RestrictionsBase { #region @addattach[:]= [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 } }