public IEnumerator TestInsertCommandCreation() => UniTask.ToCoroutine(async() =>
        {
            using (var dbConnection =
                       new DbConnection(SQLiteOpenFlags.FullMutex | SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create))
            {
                var obj1  = new TestObj();
                var obj2  = new TestObj();
                var taskA = UniTask.Run(() => { dbConnection.Insert(obj1); });
                var taskB = UniTask.Run(() => { dbConnection.Insert(obj2); });

                await UniTask.WhenAll(taskA, taskB);
            }
        });
Esempio n. 2
0
        public async Task Sample02()
        {
            using (var cubes = new SampleCubes(new Vector3(0f, 3f, 0f), new Vector3(0f, 3f, 0f), new Vector3(0f, 3f, 0f)))
            {
                await Anime.Delay(1f);

                await Task.WhenAll(
                    CircleAnimation(cubes[0], 0.0f),
                    CircleAnimation(cubes[1], 0.2f),
                    CircleAnimation(cubes[2], 0.4f)
                    );

                await Anime.Delay(1f);
            }
        }
        public IEnumerator TestLoad() => UniTask.ToCoroutine(async() =>
        {
            try
            {
                var tokenSource = new CancellationTokenSource();
                var tasks       = new List <UniTask>();
                tasks.Add(new DbReader(tokenSource.Token).Run());
                tasks.Add(new DbWriter(tokenSource.Token).Run());

                // Wait 5sec
                tokenSource.CancelAfter(5000);

                await UniTask.WhenAll(tasks);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        });