Repository navigation
Expand file tree
/
Copy pathRepoDbCursorHelperTests.cs
More file actions
61 lines (51 loc) · 2.02 KB
/
Copy pathRepoDbCursorHelperTests.cs
File metadata and controls
61 lines (51 loc) · 2.02 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System.Collections.Generic;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RepoDb.PagingPrimitives.CursorPaging;
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++]);
}
}
[TestMethod]
public void TestCursorParsingFromStringParams()
{
var testIndexes = new[] { 10, 100, 1000, 1000000, 1000000000 };
TestContext.WriteLine("Parsing Cursors...");
foreach (var index in testIndexes)
{
var cursor = CursorFactory.CreateCursor(index);
var cursorIndex = CursorFactory.ParseCursor(cursor);
TestContext.WriteLine($"[{cursor}] ==> [{cursorIndex}]");
//Assert our results are valid...
cursorIndex.Should().BePositive();
cursorIndex.Should().Be(index);
}
}
}
}