public void Identifier_Encode_Decode(ulong one, ulong two)
        {
            var item = Identifier.Encode(one, two);

            Identifier.Decode(item, out var oneX, out var twoX);
            Assert.Equal(one, oneX);
            Assert.Equal(two, twoX);
        }
Exemplo n.º 2
0
        public void Can_Sort_Identifiers_Serialized_Without_Using_Colon_Separators()
        {
            var id0 = Id <IdTests>("12345", false);
            var id1 = Id <IdTests>("12345", false);
            var id2 = Id <IdTests>("1235", false);
            var id3 = Id <IdTests>("99231", false);
            var id4 = Id <TestBase>("99231", false);

            Assert.IsFalse(Identifier.Decode(id0.ToString()).Contains(":"));
            Assert.IsTrue(id0 == id1);
            Assert.IsTrue(id0 <= id1);
            Assert.IsTrue(id0 >= id1);
            Assert.IsFalse(id0 < id1);
            Assert.IsFalse(id0 > id1);
            Assert.IsTrue(id1 > id2);
            Assert.IsTrue(id1 >= id2);
            Assert.IsTrue(id2 < id3);
            Assert.IsTrue(id2 <= id3);
            Assert.IsTrue(id3 < id4);
            Assert.IsTrue(id3 <= id4);
            Assert.IsFalse(id3 == id4);
            Assert.IsTrue(id3 != id4);
        }
Exemplo n.º 3
0
        public void Can_Sort_Identifiers_Serialized_Without_Using_Colon_Separators()
        {
            var cursor0 = Cursor.New <IdTests>("12345", false);
            var cursor1 = Cursor.New <IdTests>("12345", false);
            var cursor2 = Cursor.New <IdTests>("1235", false);
            var cursor3 = Cursor.New <IdTests>("99231", false);
            var cursor4 = Cursor.New <TestBase>("99231", false);

            Assert.IsFalse(Identifier.Decode(cursor0.ToString()).Contains(":"));
            Assert.IsTrue(cursor0 == cursor1);
            Assert.IsTrue(cursor0 <= cursor1);
            Assert.IsTrue(cursor0 >= cursor1);
            Assert.IsFalse(cursor0 < cursor1);
            Assert.IsFalse(cursor0 > cursor1);
            Assert.IsTrue(cursor1 > cursor2);
            Assert.IsTrue(cursor1 >= cursor2);
            Assert.IsTrue(cursor2 < cursor3);
            Assert.IsTrue(cursor2 <= cursor3);
            Assert.IsTrue(cursor3 < cursor4);
            Assert.IsTrue(cursor3 <= cursor4);
            Assert.IsFalse(cursor3 == cursor4);
            Assert.IsTrue(cursor3 != cursor4);
        }