Esempio n. 1
0
        public void ThenBlocksUntilCompletion()
        {
            var resumed = false;

            AsyncExtensions.RunSynchronously((async() =>
            {
                await Task.Yield();
                resumed = true;
            }));
            resumed.ShouldBe(true);
        }
Esempio n. 2
0
        public void ThenExecutesOnTheSameThread()
        {
            var testThread  = Thread.CurrentThread.ManagedThreadId;
            var asyncThread = AsyncExtensions.RunSynchronously(async() =>
            {
                await Task.Delay(0);
                return(Thread.CurrentThread.ManagedThreadId);
            });

            testThread.ShouldBe(asyncThread);
        }
Esempio n. 3
0
 /// <inheritdoc/>
 public bool TryRemove(TIdentity id) => AsyncExtensions.RunSynchronously(() => Inner.TryRemoveAsync(id));
Esempio n. 4
0
 /// <inheritdoc/>
 public bool TryRemove(TRoot item) => AsyncExtensions.RunSynchronously(() => Inner.TryRemoveAsync(item));
Esempio n. 5
0
 /// <inheritdoc/>
 public void Remove(TIdentity id) => AsyncExtensions.RunSynchronously(() => Inner.RemoveAsync(id));
Esempio n. 6
0
 /// <inheritdoc/>
 public void Remove(TRoot item) => AsyncExtensions.RunSynchronously(() => Inner.RemoveAsync(item));
Esempio n. 7
0
 /// <inheritdoc/>
 public void Update(TRoot item) => AsyncExtensions.RunSynchronously(() => Inner.UpdateAsync(item));
Esempio n. 8
0
 /// <inheritdoc/>
 public void Add(TRoot item) => AsyncExtensions.RunSynchronously(() => Inner.AddAsync(item));
Esempio n. 9
0
 /// <inheritdoc/>
 public bool TryGetById(TIdentity id, out TRoot result)
 {
     result = AsyncExtensions.RunSynchronously(() => Inner.TryGetByIdAsync(id));
     return(!Equals(result, default(TRoot)));
 }
Esempio n. 10
0
 /// <inheritdoc/>
 public TRoot GetById(TIdentity id) => AsyncExtensions.RunSynchronously(() => Inner.GetByIdAsync(id));
Esempio n. 11
0
 /// <inheritdoc/>
 public IEnumerable <TRoot> GetAll() => AsyncExtensions.RunSynchronously(() => Inner.GetAllAsync());
Esempio n. 12
0
 /// <inheritdoc/>
 public long GetCount() => AsyncExtensions.RunSynchronously(() => Inner.GetCountAsync());
 /// <inheritdoc/>
 public void Commit() => AsyncExtensions.RunSynchronously(() => Inner.CommitAsync());