161b27e2f2
(hopefully) fix an issue with banned players causing exception if they create events before they are kicked out fix issues with sometimes wrong error message for timeout show most recent IP address at top of alias list optimization to some sql queries
53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using IW4MAdmin.Application;
|
|
using SharedLibraryCore;
|
|
using SharedLibraryCore.Database.Models;
|
|
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,
|
|
Origin = new EFClient()
|
|
{
|
|
Name = $"Player1",
|
|
NetworkId = 1,
|
|
ClientNumber = 1
|
|
},
|
|
Owner = Manager.GetServers()[0]
|
|
};
|
|
|
|
Manager.GetEventHandler().AddEvent(e);
|
|
e.Complete();
|
|
|
|
var client = Manager.GetServers()[0].Clients[0];
|
|
|
|
e = new GameEvent()
|
|
{
|
|
Type = GameEvent.EventType.Say,
|
|
Origin = client,
|
|
Data = "nigger",
|
|
Owner = e.Owner
|
|
};
|
|
|
|
Manager.GetEventHandler().AddEvent(e);
|
|
e.Complete();
|
|
|
|
Assert.True(client.Warnings == 1, "client wasn't warned for objectional language");
|
|
}
|
|
}
|
|
}
|