Exemple #1
0
        public void Should_match_when_all_providers_equal_with_guid_method()
        {
            // Arrange
            var generator1 = new NewIdGenerator(_tickProvider, _workerIdProvider, _processIdProvider);
            var generator2 = new NewIdGenerator(_tickProvider, _workerIdProvider, _processIdProvider);

            generator1.Next().ToGuid();
            generator2.NextGuid();

            // Act
            var id1 = generator1.Next().ToGuid();
            var id2 = generator2.NextGuid();

            // Assert
            Assert.AreEqual(id1, id2);
        }
Exemple #2
0
        public void Should_match_sequentially()
        {
            var generator = new NewIdGenerator(_tickProvider, _workerIdProvider);

            var id1 = generator.Next().ToGuid();
            var id2 = generator.NextGuid();
            var id3 = generator.NextGuid();

            Assert.AreNotEqual(id1, id2);
            Assert.AreNotEqual(id2, id3);
            Assert.Greater(id2, id1);

            Console.WriteLine(id1);
            Console.WriteLine(id2);
            Console.WriteLine(id3);

            NewId nid1 = id1.ToNewId();
            NewId nid2 = id2.ToNewId();
        }