Exemplo n.º 1
0
        public async Task ShouldReturnNoExistsWhenQueryGivenNewKey()
        {
            var key = Utility.NewPassword(16);

            var(exists, token) = await lockService.Query <string>(key);

            Assert.IsFalse(exists);
            Assert.AreEqual(default, token);
Exemplo n.º 2
0
        public static async Task WaitFor(this ILockService lockService, string key, int millisecondsDelayInLoop = 100)
        {
            while (true)
            {
                await Task.Delay(millisecondsDelayInLoop);

                var(exists, _) = await lockService.Query <string>(key);

                if (!exists)
                {
                    break;
                }
            }
        }