Exemple #1
0
        public async Task WaitAsyncTest()
        {
            var rp = new AsyncReactiveProperty <int>(128);

            var f = await rp.FirstAsync();

            f.Should().Be(128);

            {
                var t = rp.WaitAsync();
                rp.Value = 99;
                rp.Value = 100;
                var v = await t;

                v.Should().Be(99);
            }

            {
                var t = rp.WaitAsync();
                rp.Value = 99;
                rp.Value = 100;
                var v = await t;

                v.Should().Be(99);
            }
        }
Exemple #2
0
        public async Task Iteration()
        {
            var rp = new AsyncReactiveProperty <int>(99);

            var f = await rp.FirstAsync();

            f.Should().Be(99);

            var array = rp.Take(5).ToArrayAsync();

            rp.Value = 100;
            rp.Value = 100;
            rp.Value = 100;
            rp.Value = 131;

            var ar = await array;

            ar.Should().BeEquivalentTo(new[] { 99, 100, 100, 100, 131 });
        }