forked from RobThree/NUlid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UlidTests.cs
526 lines (421 loc) · 20.6 KB
/
UlidTests.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUlid.Rng;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
namespace NUlid.Tests
{
[TestClass]
public class UlidTests
{
// test-constants
private static readonly DateTime UNIXEPOCH = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
private static readonly DateTimeOffset KNOWNTIMESTAMP_DTO = DateTimeOffset.FromUnixTimeMilliseconds(1469918176385);
private const string KNOWNTIMESTAMP_STRING = "01ARYZ6S41";
private const string KNOWNRANDOMSEQ_STRING = "DEADBEEFDEADBEEF";
private const string KNOWNMAXTIMESTAMP_STRING = "76EZ91ZPZZ";
private const string KNOWNMINRANDOM_STRING = "0000000000000000";
private const string KNOWNMAXRANDOM_STRING = "ZZZZZZZZZZZZZZZZ";
private static DateTimeOffset StripMicroSeconds(DateTimeOffset t) =>
// We can't use DateTimeOffsets to compare since the resolution of a ulid is milliseconds, and DateTimeOffset
// has microseconds and more. So we drop that part by converting to UnixTimeMilliseconds and then back to
// a DateTimeOffset.
DateTimeOffset.FromUnixTimeMilliseconds(t.ToUnixTimeMilliseconds());
[TestMethod]
public void NewUlid_Creates_NewUlid()
{
var target = Ulid.NewUlid();
Assert.AreEqual(26, target.ToString().Length);
}
[TestMethod]
public void NewUlid_Uses_SpecifiedRNG()
{
var target = Ulid.NewUlid(new FakeUlidRng());
CollectionAssert.AreEqual(FakeUlidRng.DEFAULTRESULT.ToArray(), target.Random);
}
[TestMethod]
public void NewUlid_Uses_SpecifiedTime()
{
var time = StripMicroSeconds(DateTimeOffset.UtcNow);
var target = Ulid.NewUlid(time);
Assert.AreEqual(time, target.Time);
}
[TestMethod]
public void Guid_CanConvertTo_Ulid()
{
var g = Guid.NewGuid();
var u = new Ulid(g);
var t = new Ulid(Guid.Empty);
Assert.AreEqual(g, u.ToGuid());
Assert.AreEqual(Ulid.Empty, t);
Assert.AreEqual(Guid.Empty, t.ToGuid());
}
[TestMethod]
public void Ulid_ToString_EncodesCorrectly()
{
var target = Ulid.NewUlid(KNOWNTIMESTAMP_DTO, new FakeUlidRng());
Assert.AreEqual(26, target.ToString().Length);
Assert.IsTrue(target.ToString().StartsWith(KNOWNTIMESTAMP_STRING));
Assert.IsTrue(target.ToString().EndsWith(KNOWNRANDOMSEQ_STRING));
}
[TestMethod]
public void Ulid_Empty_IsCorrectValue()
{
var target = Ulid.Empty;
Assert.AreEqual(UNIXEPOCH, target.Time);
Assert.IsTrue(target.Random.All(v => v == 0));
Assert.AreEqual(new string('0', 26), target.ToString());
}
[TestMethod]
public void Ulid_Parse_ParsesCorrectly()
{
var ulid = Ulid.NewUlid();
var target = Ulid.Parse(ulid.ToString());
Assert.IsTrue(target.Random.SequenceEqual(ulid.Random));
Assert.AreEqual(ulid.Time, target.Time);
}
[TestMethod]
public void Ulid_EqualsOperator_WorksCorrectly()
{
var a = Ulid.NewUlid();
var b = new Ulid(a.ToByteArray());
Assert.IsTrue(a == b);
}
[TestMethod]
public void Ulid_NotEqualsOperator_WorksCorrectly()
{
var a = Ulid.NewUlid(KNOWNTIMESTAMP_DTO, new FakeUlidRng());
var b = Ulid.NewUlid(KNOWNTIMESTAMP_DTO.AddMilliseconds(1), new FakeUlidRng());
Assert.IsTrue(a != b);
}
[TestMethod]
public void Ulid_Equals_WorksCorrectly()
{
var a = Ulid.NewUlid();
var b = new Ulid(a.ToByteArray());
Assert.IsTrue(a.Equals(b));
Assert.IsTrue(a.Equals(a));
Assert.IsFalse(a.Equals(Ulid.Empty));
}
[TestMethod]
public void Ulid_ObjectEquals_WorksCorrectly()
{
var a = Ulid.NewUlid();
var b = new Ulid(a.ToByteArray());
Assert.IsTrue(a.Equals((object)b));
Assert.IsTrue(a.Equals((object)a));
Assert.IsFalse(a.Equals((object)Ulid.Empty));
Assert.IsFalse(a.Equals(null));
Assert.IsFalse(a.Equals(new object()));
}
[TestMethod]
public void Ulid_CompareTo_WorksCorrectly()
{
var a = Ulid.NewUlid(KNOWNTIMESTAMP_DTO, new FakeUlidRng());
var b = Ulid.NewUlid(KNOWNTIMESTAMP_DTO, new FakeUlidRng());
var c = Ulid.NewUlid(KNOWNTIMESTAMP_DTO.AddMilliseconds(-1), new FakeUlidRng());
var d = Ulid.NewUlid(KNOWNTIMESTAMP_DTO.AddMilliseconds(+1), new FakeUlidRng());
Assert.AreEqual(0, a.CompareTo(b));
Assert.AreEqual(1, a.CompareTo(c));
Assert.AreEqual(-1, a.CompareTo(d));
var rmin = a.ToByteArray(); rmin[15]--;
var rplus = a.ToByteArray(); rplus[15]++;
var e = new Ulid(rmin);
var f = new Ulid(rplus);
Assert.AreEqual(1, a.CompareTo(e));
Assert.AreEqual(-1, a.CompareTo(f));
}
[TestMethod]
public void Ulid_RandomIs_Immutable()
{
Ulid.MinValue.Random[0] = 42;
Assert.AreEqual(0, Ulid.MinValue.Random[0]);
Ulid.MaxValue.Random[0] = 42;
Assert.AreEqual(255, Ulid.MaxValue.Random[0]);
Ulid.Empty.Random[0] = 42;
Assert.AreEqual(0, Ulid.Empty.Random[0]);
var u = Ulid.NewUlid(new FakeUlidRng());
u.Random[0] = 42;
Assert.AreEqual(107, u.Random[0]);
// Make sure when we pass an array into the constructor we cannot modify the source array (constructor copies, doesn't use reference)
var x = Ulid.MaxValue.ToByteArray();
var t = new Ulid(x);
x[6] = 0;
Assert.AreEqual(255, t.Random[0]);
}
[TestMethod]
public void Ulid_HandlesMaxTimeCorrectly()
{
var target = new Ulid(KNOWNMAXTIMESTAMP_STRING + KNOWNMAXRANDOM_STRING);
Assert.AreEqual(StripMicroSeconds(DateTimeOffset.MaxValue), target.Time);
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
public void Ulid_HandlesMaxTimePlus1MSCorrectly()
{
var maxtime_plusone = "76EZ91ZQ00";
new Ulid(maxtime_plusone + KNOWNMINRANDOM_STRING);
}
[TestMethod]
public void Ulid_ObjectCompareTo_WorksCorrectly()
{
var a = Ulid.NewUlid(KNOWNTIMESTAMP_DTO, new FakeUlidRng());
var b = Ulid.NewUlid(KNOWNTIMESTAMP_DTO, new FakeUlidRng());
var c = Ulid.NewUlid(KNOWNTIMESTAMP_DTO.AddMilliseconds(-1), new FakeUlidRng());
var d = Ulid.NewUlid(KNOWNTIMESTAMP_DTO.AddMilliseconds(+1), new FakeUlidRng());
Assert.AreEqual(0, a.CompareTo((object)b));
Assert.AreEqual(1, a.CompareTo((object)c));
Assert.AreEqual(-1, a.CompareTo((object)d));
Assert.AreEqual(1, a.CompareTo(null));
var rmin = a.ToByteArray(); rmin[15]--;
var rplus = a.ToByteArray(); rplus[15]++;
var e = new Ulid(rmin);
var f = new Ulid(rplus);
Assert.AreEqual(1, a.CompareTo((object)e));
Assert.AreEqual(-1, a.CompareTo((object)f));
}
[TestMethod]
public void Ulid_GetHashCode_WorksCorrectly()
{
var rng = new FakeUlidRng();
var hashcodes = new List<int>()
{
Ulid.MinValue.GetHashCode(),
Ulid.MaxValue.GetHashCode(),
Ulid.NewUlid().GetHashCode(),
};
hashcodes.AddRange(Enumerable.Range(0, 1000).Select(i => Ulid.NewUlid(KNOWNTIMESTAMP_DTO.AddMilliseconds(i)).GetHashCode()));
hashcodes.AddRange(Enumerable.Range(0, 1000).Select(i => Ulid.NewUlid(KNOWNTIMESTAMP_DTO.AddMilliseconds(i), rng).GetHashCode()));
Assert.AreEqual(3 + 1000 + 1000, hashcodes.Distinct().Count());
}
[TestMethod]
public void Ulid_TryParse_WorksCorrectly()
{
Assert.IsFalse(Ulid.TryParse("X", out var r1));
Assert.AreEqual(Ulid.Empty, r1);
Assert.IsFalse(Ulid.TryParse(string.Empty, out var r2));
Assert.AreEqual(Ulid.Empty, r2);
Assert.IsFalse(Ulid.TryParse(null, out var r3));
Assert.AreEqual(Ulid.Empty, r3);
Assert.IsTrue(Ulid.TryParse(Ulid.MinValue.ToString(), out var r4));
Assert.IsTrue(Ulid.MinValue == r4);
Assert.IsTrue(Ulid.TryParse(Ulid.MaxValue.ToString(), out var r5));
Assert.IsTrue(Ulid.MaxValue == r5);
var target = Ulid.NewUlid(KNOWNTIMESTAMP_DTO, new FakeUlidRng());
Assert.IsTrue(Ulid.TryParse(KNOWNTIMESTAMP_STRING + KNOWNRANDOMSEQ_STRING, out var r6));
Assert.AreEqual(r6, target);
}
[TestMethod]
public void Ulid_Parse_WorksCorrectly()
{
Assert.AreEqual(Ulid.MinValue, Ulid.Parse(Ulid.MinValue.ToString()));
Assert.AreEqual(Ulid.MaxValue, Ulid.Parse(Ulid.MaxValue.ToString()));
var target = Ulid.NewUlid(KNOWNTIMESTAMP_DTO, new FakeUlidRng());
Assert.AreEqual(Ulid.Parse(KNOWNTIMESTAMP_STRING + KNOWNRANDOMSEQ_STRING), target);
Assert.AreEqual(new Ulid(KNOWNTIMESTAMP_STRING + KNOWNRANDOMSEQ_STRING), target);
}
[TestMethod]
public void Ulid_IsCaseInsensitive()
{
var target = new Ulid(KNOWNTIMESTAMP_STRING + KNOWNRANDOMSEQ_STRING);
Assert.AreEqual(new Ulid(KNOWNTIMESTAMP_STRING.ToLowerInvariant() + KNOWNRANDOMSEQ_STRING.ToLowerInvariant()), target);
}
[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Ulid_ObjectCompareTo_Throws() => Ulid.NewUlid().CompareTo(new object());
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void Ulid_Parse_ThrowsArgumentNullException_OnNull() => Ulid.Parse(null);
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void Ulid_Parse_ThrowsArgumentNullException_OnEmptyString() => Ulid.Parse(string.Empty);
[TestMethod]
[ExpectedException(typeof(FormatException))]
public void Ulid_Parse_ThrowsFormatException_OnInvalidLengthString() => Ulid.Parse("TEST");
[TestMethod]
public void Ulid_Parse_Handles_IiLl_TreatedAs_One() //https://www.crockford.com/base32.html
{
Assert.AreEqual(Ulid.Parse(KNOWNTIMESTAMP_STRING + KNOWNRANDOMSEQ_STRING), Ulid.Parse(KNOWNTIMESTAMP_STRING.Replace('1', 'i') + KNOWNRANDOMSEQ_STRING));
Assert.AreEqual(Ulid.Parse(KNOWNTIMESTAMP_STRING + KNOWNRANDOMSEQ_STRING), Ulid.Parse(KNOWNTIMESTAMP_STRING.Replace('1', 'I') + KNOWNRANDOMSEQ_STRING));
Assert.AreEqual(Ulid.Parse(KNOWNTIMESTAMP_STRING + KNOWNRANDOMSEQ_STRING), Ulid.Parse(KNOWNTIMESTAMP_STRING.Replace('1', 'l') + KNOWNRANDOMSEQ_STRING));
Assert.AreEqual(Ulid.Parse(KNOWNTIMESTAMP_STRING + KNOWNRANDOMSEQ_STRING), Ulid.Parse(KNOWNTIMESTAMP_STRING.Replace('1', 'L') + KNOWNRANDOMSEQ_STRING));
}
[TestMethod]
public void Ulid_Parse_Handles_Oo_TreatedAs_Zero() //https://www.crockford.com/base32.html
{
Assert.AreEqual(Ulid.Parse(KNOWNTIMESTAMP_STRING + KNOWNRANDOMSEQ_STRING), Ulid.Parse(KNOWNTIMESTAMP_STRING.Replace('0', 'o') + KNOWNRANDOMSEQ_STRING));
Assert.AreEqual(Ulid.Parse(KNOWNTIMESTAMP_STRING + KNOWNRANDOMSEQ_STRING), Ulid.Parse(KNOWNTIMESTAMP_STRING.Replace('0', 'O') + KNOWNRANDOMSEQ_STRING));
}
[TestMethod]
[ExpectedException(typeof(FormatException))]
public void Ulid_Parse_ThrowsFormatException_OnInvalidString1() => Ulid.Parse(KNOWNTIMESTAMP_STRING + KNOWNRANDOMSEQ_STRING.Replace('E', 'U')); // U is not in BASE32 alphabet
[TestMethod]
[ExpectedException(typeof(FormatException))]
public void Ulid_Parse_ThrowsFormatException_OnInvalidString2() => Ulid.Parse(KNOWNTIMESTAMP_STRING + KNOWNRANDOMSEQ_STRING.Replace('E', '{')); // Test char after last index in C2B32 array
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void Ulid_Constructor_ThrowsArgumentException_OnNullByteArray() => new Ulid((byte[])null);
[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Ulid_Constructor_ThrowsArgumentException_OnInvalidByteArray() => new Ulid(new byte[] { 1, 2, 3 });
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void Ulid_NewUlid_ThrowsArgumentNullException_OnNullRng() => Ulid.NewUlid(Ulid.MinValue.Time, null);
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
public void Ulid_NewUlid_ThrowsArgumentOutOfRangeException_OnTimestamp() => Ulid.NewUlid(Ulid.MinValue.Time.AddMilliseconds(-1));
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
public void Ulid_NewUlid_ThrowsInvalidOperationException_OnRNGReturningInsufficientBytes()
{
var rng = new FakeUlidRng(new byte[] { 1, 2, 3 });
Ulid.NewUlid(rng);
}
[TestMethod]
public void Ulid_TypeConverter_CanGetUsableConverter()
{
var converter = TypeDescriptor.GetConverter(typeof(Ulid));
Assert.IsNotNull(converter);
Assert.IsTrue(converter.CanConvertFrom(typeof(string)));
Assert.IsTrue(converter.CanConvertFrom(typeof(byte[])));
}
[TestMethod]
public void Ulid_TypeConverter_CanConvertFromString()
{
var original = Ulid.NewUlid();
var ulidString = original.ToString();
var converter = TypeDescriptor.GetConverter(typeof(Ulid));
var converted = converter.ConvertFromString(ulidString);
Assert.AreEqual(original, converted);
}
[TestMethod]
public void Ulid_TypeConverter_CanConvertFromByteArray()
{
var original = Ulid.NewUlid();
var ulidByteArray = original.ToByteArray();
var converter = TypeDescriptor.GetConverter(typeof(Ulid));
var converted = converter.ConvertFrom(ulidByteArray);
Assert.AreEqual(original, converted);
}
[TestMethod]
public void Ulid_TypeConverter_CanConvertToString()
{
var ulid = Ulid.NewUlid();
var expectedUlidString = ulid.ToString();
var converter = TypeDescriptor.GetConverter(typeof(Ulid));
var ulidString = converter.ConvertToString(ulid);
Assert.AreEqual(expectedUlidString, ulidString);
}
[TestMethod]
public void Ulid_TypeConverter_CanConvertToByteArray()
{
var ulid = Ulid.NewUlid();
var expectedByteArray = ulid.ToByteArray();
var converter = TypeDescriptor.GetConverter(typeof(Ulid));
var ulidByteArray = (byte[])converter.ConvertTo(ulid, typeof(byte[]));
Assert.IsTrue(expectedByteArray.SequenceEqual(ulidByteArray));
}
#pragma warning disable SYSLIB0011 // Type or member is obsolete
[TestMethod]
public void Ulid_IsSerializable_UsingBinaryFormatter()
{
var target = Ulid.NewUlid();
var formatter = new BinaryFormatter();
using (var stream = new MemoryStream())
{
formatter.Serialize(stream, target);
stream.Position = 0;
var result = formatter.Deserialize(stream);
Assert.AreEqual(target, result);
}
}
[TestMethod]
public void Ulid_IsSerializable_UsingDataContract()
{
var target = Ulid.NewUlid();
var serializer = new DataContractSerializer(target.GetType());
using (var stream = new MemoryStream())
{
serializer.WriteObject(stream, target);
stream.Position = 0;
var result = serializer.ReadObject(stream);
Assert.AreEqual(target, result);
}
}
#pragma warning restore SYSLIB0011 // Type or member is obsolete
[TestMethod]
public void InstanceCreatedWithoutRunningConstructor_Equals_EmptyUlid()
{
var target = Activator.CreateInstance<Ulid>();
Assert.IsTrue(target.Equals(Ulid.Empty));
}
[TestMethod]
public void MonotonicRng_Sequence_Testvectors()
{
var target = Ulid.Parse("01BX5ZZKBKACTAV9WEVGEMMVRY");
var rng = new MonotonicUlidRng(new FakeUlidRng(), lastValue: target);
Assert.AreEqual("01BX5ZZKBKACTAV9WEVGEMMVRZ", Ulid.NewUlid(target.Time, rng).ToString());
Assert.AreEqual("01BX5ZZKBKACTAV9WEVGEMMVS0", Ulid.NewUlid(target.Time, rng).ToString());
Assert.AreEqual("01BX5ZZKBKACTAV9WEVGEMMVS1", Ulid.NewUlid(target.Time, rng).ToString());
}
[TestMethod]
[ExpectedException(typeof(OverflowException))]
public void MonotonicRng_Sequence_Throws_OnOverflow()
{
var target = Ulid.Parse("01BX5ZZKBKZZZZZZZZZZZZZZZX");
var rng = new MonotonicUlidRng(new FakeUlidRng(), lastValue: target);
Assert.IsTrue(Ulid.NewUlid(target.Time, rng).ToString().EndsWith("ZZZZZZZZZZZZZZZY"));
Assert.IsTrue(Ulid.NewUlid(target.Time, rng).ToString().EndsWith("ZZZZZZZZZZZZZZZZ"));
Ulid.NewUlid(target.Time, rng); // Should throw
}
[TestMethod]
public void MonotonicRng_Sequence_Resets_OnNewTimeStamp()
{
var target = Ulid.Parse("01BX5ZZKBKZZZZZZZZZZZZZZZX");
var rng = new MonotonicUlidRng(new FakeUlidRng(), lastValue: target);
Assert.IsTrue(Ulid.NewUlid(target.Time, rng).ToString().EndsWith("ZZZZZZZZZZZZZZZY"));
Assert.IsTrue(Ulid.NewUlid(target.Time, rng).ToString().EndsWith("ZZZZZZZZZZZZZZZZ"));
// Now we change the time, JUST in time before we overflow
var result = Ulid.NewUlid(target.Time.Add(TimeSpan.FromMilliseconds(1)), rng); // Should NOT throw
Assert.AreEqual("01BX5ZZKBMDEADBEEFDEADBEEF", result.ToString()); // We should have a new "random" value and timestamp should have increased by one
}
[TestMethod]
public void Parse_Allows_Hyphens()
{
Assert.AreEqual(Ulid.Parse("01BX5ZZKBKACTAV9WEVGEMMVRZ"), Ulid.Parse("01BX5ZZKBK-ACTA-V9WE-VGEM-MVRZ"));
Assert.AreEqual(Ulid.Parse("01BX5ZZKBKACTAV9WEVGEMMVRZ"), Ulid.Parse("01BX5ZZKBK-ACTAV9WEVGEMMVRZ"));
}
[TestMethod]
public void GreaterThanOperator()
{
Assert.IsTrue(new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS1") > new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS0"));
Assert.IsFalse(new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS1") > new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS1"));
Assert.IsFalse(new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS0") > new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS1"));
}
[TestMethod]
public void GreaterThanOrEqualOperator()
{
Assert.IsTrue(new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS1") >= new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS0"));
Assert.IsTrue(new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS1") >= new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS1"));
Assert.IsFalse(new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS0") >= new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS1"));
}
[TestMethod]
public void LessThanOperator()
{
Assert.IsTrue(new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS0") < new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS1"));
Assert.IsFalse(new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS0") < new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS0"));
Assert.IsFalse(new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS1") < new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS0"));
}
[TestMethod]
public void LessThanOrEqualOperator()
{
Assert.IsTrue(new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS0") <= new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS1"));
Assert.IsTrue(new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS0") <= new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS0"));
Assert.IsFalse(new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS1") <= new Ulid("01BX5ZZKBKACTAV9WEVGEMMVS0"));
}
}
}