Beispiel #1
0
        public void SyncException()
        {
            var asyncValue = new AsyncValue <int>(SyncErrorInput);

            Assert.AreEqual(LoadState.Unloaded, asyncValue.State);
            Assert.AreEqual(default(int), asyncValue.Value);

            var loadHappened = false;

            asyncValue.ValueLoaded += (sender, args) =>
            {
                loadHappened = true;
            };

            var errorHappened = false;

            asyncValue.LoadError += (sender, args) =>
            {
                errorHappened = true;
            };

            asyncValue.Load();
            Assert.IsFalse(loadHappened);
            Assert.IsTrue(errorHappened);
        }
Beispiel #2
0
        public void BasicAsync()
        {
            var asyncValue = new AsyncValue<int>(AsyncTestInput);
            Assert.AreEqual(LoadState.Unloaded, asyncValue.State);
            Assert.AreEqual(default(int), asyncValue.Value);

            asyncValue.ValueLoaded += (sender, args) => asyncValue_handleLoad(asyncValue);
            asyncValue.Load();
            Assert.AreEqual(LoadState.Loading, asyncValue.State);
        }
Beispiel #3
0
        public void BasicAsync()
        {
            var asyncValue = new AsyncValue <int>(AsyncTestInput);

            Assert.AreEqual(LoadState.Unloaded, asyncValue.State);
            Assert.AreEqual(default(int), asyncValue.Value);

            asyncValue.ValueLoaded += (sender, args) => asyncValue_handleLoad(asyncValue);
            asyncValue.Load();
            Assert.AreEqual(LoadState.Loading, asyncValue.State);
        }
Beispiel #4
0
        public void BasicSynchronous()
        {
            var asyncValue = new AsyncValue<int>(SyncTestInput);
            Assert.AreEqual(LoadState.Unloaded, asyncValue.State);
            Assert.AreEqual(default(int), asyncValue.Value);

            var loadHappened = false;
            asyncValue.ValueLoaded += (sender, args) =>
            {
                loadHappened = true;
            };
            asyncValue.Load();
            Assert.IsTrue(loadHappened);
        }
Beispiel #5
0
        public void BasicSynchronous()
        {
            var asyncValue = new AsyncValue <int>(SyncTestInput);

            Assert.AreEqual(LoadState.Unloaded, asyncValue.State);
            Assert.AreEqual(default(int), asyncValue.Value);

            var loadHappened = false;

            asyncValue.ValueLoaded += (sender, args) =>
            {
                loadHappened = true;
            };
            asyncValue.Load();
            Assert.IsTrue(loadHappened);
        }
Beispiel #6
0
        public void SyncException()
        {
            var asyncValue = new AsyncValue<int>(SyncErrorInput);
            Assert.AreEqual(LoadState.Unloaded, asyncValue.State);
            Assert.AreEqual(default(int), asyncValue.Value);

            var loadHappened = false;
            asyncValue.ValueLoaded += (sender, args) =>
            {
                loadHappened = true;
            };

            var errorHappened = false;
            asyncValue.LoadError += (sender, args) =>
            {
                errorHappened = true;
            };

            asyncValue.Load();
            Assert.IsFalse(loadHappened);
            Assert.IsTrue(errorHappened);
        }