-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathRepoDbCursorHelperTests.cs
43 lines (36 loc) · 1.36 KB
/
RepoDbCursorHelperTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System.Collections.Generic;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RepoDb.PagingPrimitives;
namespace RepoDb.SqlServer.PagingOperations.Tests
{
[TestClass]
public class RepoDbCursorHelperTests : BaseTest
{
[TestMethod]
public void TestCursorCreationAndParsing()
{
var testIndexes = new[] { 4, 16, 744, 7422999, int.MaxValue };
var createdCursors = new List<string>();
TestContext.WriteLine("Creating Cursors...");
foreach (var index in testIndexes)
{
var cursor = CursorFactory.CreateCursor(index);
TestContext.WriteLine($"[{index}] ==> [{cursor}]");
//Assert our results are valid...
cursor.Should().NotBeNullOrWhiteSpace();
createdCursors.Add(cursor);
}
TestContext.WriteLine("Parsing Cursors...");
var i = 0;
foreach (var cursor in createdCursors)
{
var cursorIndex = CursorFactory.ParseCursor(cursor);
TestContext.WriteLine($"[{cursor}] ==> [{cursorIndex}]");
//Assert our results are valid...
cursorIndex.Should().BePositive();
cursorIndex.Should().Be(testIndexes[i++]);
}
}
}
}