Esempio n. 1
0
        public void TestSerializer()
        {
            var id          = Ulid.NewUlid();
            var byteArray   = new byte[16];
            var startOffset = 0;
            var formatter   = new UlidFormatter();

            formatter.Serialize(ref byteArray, ref startOffset, id);

            Assert.That(startOffset, Is.EqualTo(16));
            Assert.That(byteArray, Is.EqualTo(id.ToByteArray()));
        }
Esempio n. 2
0
        public void TestDeserializer()
        {
            var id          = Ulid.NewUlid();
            var byteArray   = new byte[16];
            var startOffset = 0;
            var formatter   = new UlidFormatter();

            formatter.Serialize(ref byteArray, ref startOffset, id);
            startOffset = 0;

            Ulid otherId = new Ulid();

            formatter.Deserialize(byteArray, ref startOffset, ref otherId);

            Assert.That(otherId, Is.EqualTo(id));
        }