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

            AsyncExtensions.RunSynchronously((async() =>
            {
                await Task.Yield();
                resumed = true;
            }));
            resumed.ShouldBe(true);
        }
Exemplo 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);
        }
Exemplo n.º 3
0
 /// <inheritdoc/>
 public bool TryRemove(TIdentity id) => AsyncExtensions.RunSynchronously(() => Inner.TryRemoveAsync(id));
Exemplo n.º 4
0
 /// <inheritdoc/>
 public bool TryRemove(TRoot item) => AsyncExtensions.RunSynchronously(() => Inner.TryRemoveAsync(item));
Exemplo n.º 5
0
 /// <inheritdoc/>
 public void Remove(TIdentity id) => AsyncExtensions.RunSynchronously(() => Inner.RemoveAsync(id));
Exemplo n.º 6
0
 /// <inheritdoc/>
 public void Remove(TRoot item) => AsyncExtensions.RunSynchronously(() => Inner.RemoveAsync(item));
Exemplo n.º 7
0
 /// <inheritdoc/>
 public void Update(TRoot item) => AsyncExtensions.RunSynchronously(() => Inner.UpdateAsync(item));
Exemplo n.º 8
0
 /// <inheritdoc/>
 public void Add(TRoot item) => AsyncExtensions.RunSynchronously(() => Inner.AddAsync(item));
Exemplo n.º 9
0
 /// <inheritdoc/>
 public bool TryGetById(TIdentity id, out TRoot result)
 {
     result = AsyncExtensions.RunSynchronously(() => Inner.TryGetByIdAsync(id));
     return(!Equals(result, default(TRoot)));
 }
Exemplo n.º 10
0
 /// <inheritdoc/>
 public TRoot GetById(TIdentity id) => AsyncExtensions.RunSynchronously(() => Inner.GetByIdAsync(id));
Exemplo n.º 11
0
 /// <inheritdoc/>
 public IEnumerable <TRoot> GetAll() => AsyncExtensions.RunSynchronously(() => Inner.GetAllAsync());
Exemplo n.º 12
0
 /// <inheritdoc/>
 public long GetCount() => AsyncExtensions.RunSynchronously(() => Inner.GetCountAsync());
 /// <inheritdoc/>
 public void Commit() => AsyncExtensions.RunSynchronously(() => Inner.CommitAsync());