You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/NzbDrone.Core.Test/Datastore/SortKeyValidationFixture.cs

30 lines
941 B

using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Datastore
{
[TestFixture]
public class SortKeyValidationFixture : DbTest
{
[TestCase("amissingcolumn")]
[TestCase("amissingtable.id")]
[TestCase("table.table.column")]
[TestCase("column; DROP TABLE Commands;--")]
public void should_return_false_for_invalid_sort_key(string sortKey)
{
TableMapping.Mapper.IsValidSortKey(sortKey).Should().BeFalse();
}
// [TestCase("artists.sortName")] TODO: Figure out why Artists table properties don't get mapped
[TestCase("Id")]
[TestCase("id")]
[TestCase("commands.id")]
public void should_return_true_for_valid_sort_key(string sortKey)
{
TableMapping.Mapper.IsValidSortKey(sortKey).Should().BeTrue();
}
}
}