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

34 lines
1.1 KiB
C#

namespace LibreMetaverse.RLV.Tests.Restrictions
{
public class SendChatRestrictionTests : RestrictionsBase
{
#region @sendchat=<y/n>
[Fact]
public async Task CanSendChat()
{
await CheckSimpleCommand("sendChat", m => m.CanSendChat());
}
[Fact]
public async Task CanChat_SendChatRestriction()
{
await _rlv.ProcessMessage("@sendchat=n", _sender.Id, _sender.Name);
// No public chat allowed unless it starts with '/'
Assert.False(_rlv.Permissions.CanChat(0, "Hello"));
// Emotes and other messages starting with / are allowed
Assert.True(_rlv.Permissions.CanChat(0, "/me says Hello"));
Assert.True(_rlv.Permissions.CanChat(0, "/ something?"));
// Messages containing ()"-*=_^ are prohibited
Assert.False(_rlv.Permissions.CanChat(0, "/me says Hello ^_^"));
// Private channels are not impacted
Assert.True(_rlv.Permissions.CanChat(5, "Hello"));
}
#endregion
}
}