mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Don't allow null arrays in constructor
This commit is contained in:
@@ -13,21 +13,15 @@ namespace SabreTools.Core.Filter
|
||||
/// <summary>
|
||||
/// Set of filters to be run against an object
|
||||
/// </summary>
|
||||
public FilterObject[] Filters { get; }
|
||||
public readonly FilterObject[] Filters;
|
||||
|
||||
public FilterRunner(FilterObject[]? filters)
|
||||
public FilterRunner(FilterObject[] filters)
|
||||
{
|
||||
if (filters == null)
|
||||
throw new ArgumentNullException(nameof(filters));
|
||||
|
||||
Filters = filters;
|
||||
}
|
||||
|
||||
public FilterRunner(string[]? filterStrings)
|
||||
public FilterRunner(string[] filterStrings)
|
||||
{
|
||||
if (filterStrings == null)
|
||||
throw new ArgumentNullException(nameof(filterStrings));
|
||||
|
||||
var filters = new List<FilterObject>();
|
||||
foreach (string filterString in filterStrings)
|
||||
{
|
||||
|
||||
@@ -6,16 +6,6 @@ namespace SabreTools.Test.Filter
|
||||
{
|
||||
public class PopulationTests
|
||||
{
|
||||
[Fact]
|
||||
public void PopulateFilterRunnerNullListTest()
|
||||
{
|
||||
// Setup the list
|
||||
string[]? filters = null;
|
||||
|
||||
// Setup the filter
|
||||
Assert.Throws<ArgumentNullException>(() => new FilterRunner(filters));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PopulateFilterRunnerEmptyListTest()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user