mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-07-16 18:43:43 +01:00
Fix event tests
This commit is contained in:
@@ -20,7 +20,7 @@ namespace Tgstation.Server.Host.Components.Events
|
||||
/// <param name="scriptNames">The value of <see cref="ScriptNames"/>.</param>
|
||||
public EventScriptAttribute(params string[] scriptNames)
|
||||
{
|
||||
ScriptNames = ScriptNames ?? throw new ArgumentNullException(nameof(scriptNames));
|
||||
ScriptNames = scriptNames ?? throw new ArgumentNullException(nameof(scriptNames));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
namespace Tgstation.Server.Host.Components.Events.Tests
|
||||
@@ -14,8 +15,8 @@ namespace Tgstation.Server.Host.Components.Events.Tests
|
||||
public void TestConstruction()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentNullException>(() => new EventScriptAttribute(null));
|
||||
var test = new EventScriptAttribute("test");
|
||||
Assert.AreEqual("test", test.ScriptName);
|
||||
var test = new EventScriptAttribute("test1", "test2");
|
||||
Assert.IsTrue(test.ScriptNames.SequenceEqual(["test1", "test2"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@ namespace Tgstation.Server.Host.Components.Events.Tests
|
||||
Assert.AreEqual(1, list.Count, $"EventType: {eventType}");
|
||||
|
||||
var attribute = list.First();
|
||||
Assert.IsTrue(allScripts.Add(attribute.ScriptName), $"Non-unique script Name: {attribute.ScriptName}");
|
||||
foreach (var scriptName in attribute.ScriptNames)
|
||||
Assert.IsTrue(allScripts.Add(scriptName), $"Non-unique script Names: {scriptName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user