2018-09-04 13:40:29 -04:00
|
|
|
|
using IW4MAdmin.Application;
|
|
|
|
|
using SharedLibraryCore;
|
2018-11-05 22:01:29 -05:00
|
|
|
|
using SharedLibraryCore.Database.Models;
|
2018-09-04 13:40:29 -04:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace Tests
|
|
|
|
|
{
|
|
|
|
|
[Collection("ManagerCollection")]
|
|
|
|
|
public class PluginTests
|
|
|
|
|
{
|
|
|
|
|
readonly ApplicationManager Manager;
|
|
|
|
|
|
|
|
|
|
public PluginTests(ManagerFixture fixture)
|
|
|
|
|
{
|
|
|
|
|
Manager = fixture.Manager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void ClientSayObjectionalWordShouldWarn()
|
|
|
|
|
{
|
|
|
|
|
var e = new GameEvent()
|
|
|
|
|
{
|
|
|
|
|
Type = GameEvent.EventType.Connect,
|
2018-11-05 22:01:29 -05:00
|
|
|
|
Origin = new EFClient()
|
2018-09-04 13:40:29 -04:00
|
|
|
|
{
|
|
|
|
|
Name = $"Player1",
|
|
|
|
|
NetworkId = 1,
|
|
|
|
|
ClientNumber = 1
|
|
|
|
|
},
|
|
|
|
|
Owner = Manager.GetServers()[0]
|
|
|
|
|
};
|
|
|
|
|
|
2020-05-04 17:50:02 -04:00
|
|
|
|
Manager.AddEvent(e);
|
2019-11-15 15:50:20 -05:00
|
|
|
|
e.Complete();
|
2018-09-04 13:40:29 -04:00
|
|
|
|
|
2018-11-05 22:01:29 -05:00
|
|
|
|
var client = Manager.GetServers()[0].Clients[0];
|
2018-09-04 13:40:29 -04:00
|
|
|
|
|
|
|
|
|
e = new GameEvent()
|
|
|
|
|
{
|
|
|
|
|
Type = GameEvent.EventType.Say,
|
|
|
|
|
Origin = client,
|
|
|
|
|
Data = "nigger",
|
2018-09-06 14:25:58 -04:00
|
|
|
|
Owner = e.Owner
|
2018-09-04 13:40:29 -04:00
|
|
|
|
};
|
|
|
|
|
|
2020-05-04 17:50:02 -04:00
|
|
|
|
Manager.AddEvent(e);
|
2019-11-15 15:50:20 -05:00
|
|
|
|
e.Complete();
|
2018-09-04 13:40:29 -04:00
|
|
|
|
|
|
|
|
|
Assert.True(client.Warnings == 1, "client wasn't warned for objectional language");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|