Ejemplo n.º 1
0
        public async void TestGetNextIDAsync()
        {
            var cip = new ContextIdentityProvider(this.sqliteOptions);

            const string mainContext = "main";
            var          nextIDList  = await cip.GetNextIDAsync(mainContext).ConfigureAwait(false);

            Assert.Single(nextIDList);
            var firstID = nextIDList.Single();

            nextIDList = await cip.GetNextIDAsync(mainContext).ConfigureAwait(false);

            Assert.Single(nextIDList);
            var nextID = nextIDList.Single();

            Assert.True(firstID < nextID);
        }
Ejemplo n.º 2
0
        public async void TestGetMultipleIDs()
        {
            var cip = new ContextIdentityProvider(this.sqliteOptions);

            const string idContext  = "secondary";
            var          count      = 10;
            var          nextIDList = await cip.GetNextIDAsync(idContext, count).ConfigureAwait(false);

            Assert.True(nextIDList.Count() == count);

            // test increment order
            long?prev = null;

            foreach (var value in nextIDList)
            {
                if (prev.HasValue)
                {
                    Assert.True(prev < value);
                }

                prev = value;
            }
        }