public void CreateUnsignedId_Initially_ShouldReturnExpectedResult()
        {
            var generator = new IncrementalIdGenerator();

            var id = generator.CreateUnsignedId();

            Assert.Equal(1UL, id);
        }
        public void CreateUnsignedId_InParallel_ShouldReturnDistinctResults()
        {
            var generator = new IncrementalIdGenerator();

            var results = new ConcurrentQueue <ulong>();

            Parallel.For(0, 100, _ => results.Enqueue(generator.CreateUnsignedId()));

            Assert.Equal(results.Count, results.Distinct().Count());
        }
        public void CreateUnsignedId_Repeatedly_ShouldReturnExpectedResults()
        {
            var generator = new IncrementalIdGenerator();

            var results = new List <ulong>();

            for (var i = 0; i < 100; i++)
            {
                results.Add(generator.CreateUnsignedId());
            }

            for (var i = 0; i < results.Count; i++)
            {
                Assert.Equal(1UL + (ulong)i, results[i]);
            }
        }