mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
fix for runaway regular expression on linux
explicitly set string dvars in quotes to allow setting empty dvars allow piping in input from command line (#114) update the distribution for top stats elo prevent game log file rotation from stopping event parsing
This commit is contained in:
47
Tests/ApplicationTests/BaseRConParserTests.cs
Normal file
47
Tests/ApplicationTests/BaseRConParserTests.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using FakeItEasy;
|
||||
using IW4MAdmin.Application.RconParsers;
|
||||
using NUnit.Framework;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
|
||||
namespace ApplicationTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class BaseRConParserTests
|
||||
{
|
||||
[Test]
|
||||
public void SetDvarAsync_FormatStringType()
|
||||
{
|
||||
var parser = new BaseRConParser(A.Fake<IParserRegexFactory>());
|
||||
var connection = A.Fake<IRConConnection>();
|
||||
|
||||
parser.SetDvarAsync(connection, "test", "test").Wait();
|
||||
|
||||
A.CallTo(() => connection.SendQueryAsync(SharedLibraryCore.RCon.StaticHelpers.QueryType.SET_DVAR, "test \"test\""))
|
||||
.MustHaveHappened();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetDvarAsync_FormatEmptyStringTypeIncludesQuotes()
|
||||
{
|
||||
var parser = new BaseRConParser(A.Fake<IParserRegexFactory>());
|
||||
var connection = A.Fake<IRConConnection>();
|
||||
|
||||
parser.SetDvarAsync(connection, "test", "").Wait();
|
||||
|
||||
A.CallTo(() => connection.SendQueryAsync(SharedLibraryCore.RCon.StaticHelpers.QueryType.SET_DVAR, "test \"\""))
|
||||
.MustHaveHappened();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetDvarAsync_FormatsNonString()
|
||||
{
|
||||
var parser = new BaseRConParser(A.Fake<IParserRegexFactory>());
|
||||
var connection = A.Fake<IRConConnection>();
|
||||
|
||||
parser.SetDvarAsync(connection, "test", 123).Wait();
|
||||
|
||||
A.CallTo(() => connection.SendQueryAsync(SharedLibraryCore.RCon.StaticHelpers.QueryType.SET_DVAR, "test 123"))
|
||||
.MustHaveHappened();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user