
* Removed a duplicate loop that was already done earlier in method. * Normalize now replaces underscores * Added more Parser cases, Added test case for SeriesExtension (Name in List), and added MergeNameTest and some TODOs for where tests should go * Added a test for removal * Fixed bad merge Co-authored-by: Andrew Song <asong641@gmail.com>
27 lines
No EOL
827 B
C#
27 lines
No EOL
827 B
C#
using System.Collections.Generic;
|
|
using API.Entities;
|
|
|
|
namespace API.Extensions
|
|
{
|
|
public static class SeriesExtensions
|
|
{
|
|
/// <summary>
|
|
/// Checks against all the name variables of the Series if it matches anything in the list.
|
|
/// </summary>
|
|
/// <param name="series"></param>
|
|
/// <param name="list"></param>
|
|
/// <returns></returns>
|
|
public static bool NameInList(this Series series, IEnumerable<string> list)
|
|
{
|
|
foreach (var name in list)
|
|
{
|
|
if (Parser.Parser.Normalize(name) == series.NormalizedName || name == series.Name || name == series.LocalizedName || name == series.OriginalName)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
} |