aurora/AuroraSignal.test/CursorList.test.cs
Brandon Watson b61ffde4c9 WIP
2021-03-05 11:56:51 -05:00

43 lines
1.3 KiB
C#

using Xunit;
using Aurora;
using Aurora.Services.Signal;
using Aurora.Cursor;
namespace AuroraSignal.test
{
public class CursorListTest
{
[Theory()]
[InlineData(SortDirection.Asc)]
[InlineData(SortDirection.Desc)]
public void CursorListSortOnStringValue(SortDirection direction)
{
CursorList<Party> list = new CursorList<Party>();
list.Add(new Party() { Name = "asdf", Id = "1111" });
list.Add(new Party() { Name = "bsdf", Id = "2222" });
list.Add(new Party() { Name = "csdf", Id = "3333" });
CursorResult<Party> result = new Cursor<Party>(ref list)
.WithSort(item => item.Value.Name, direction)
.GetNextPage();
if (direction == SortDirection.Desc)
{
Assert.Collection<Party>(result.Result,
item => item.Name.Equals("asdf"),
item => item.Name.Equals("bsdf"),
item => item.Name.Equals("csdf"));
}
else
{
Assert.Collection<Party>(result.Result,
item => item.Name.Equals("csdf"),
item => item.Name.Equals("bsdf"),
item => item.Name.Equals("asdf"));
}
}
}
}