Exemplo n.º 1
0
        public void RunTest2()
        {
            var runner = new AsyncRunner <string>();

            runner.RegisterFunction(() => "HELLO WORLD!");

            bool isSuccessfull = runner.Wait();

            Assert.That(isSuccessfull);
            Assert.That(runner.Result, Is.EqualTo("HELLO WORLD!"));
        }
Exemplo n.º 2
0
        public void ThrowException()
        {
            byte countHandledException = 0;
            var  runner = new AsyncRunner <string>();

            runner.ThrownExceptions.Subscribe(exc =>
            {
                countHandledException++;
                Assert.That(exc, Is.InstanceOf <Exception>());
                Assert.That(exc.Message, Is.EqualTo("SASAI LALKA!"));

                throw exc;
            });
            runner.RegisterFunction(() =>
            {
                throw new Exception("SASAI LALKA!");
            });

            if (runner.Wait())
            {
                Assert.Fail();
            }

            if (runner.Wait())
            {
                Assert.Fail();
            }

            if (runner.Wait())
            {
                Assert.Fail();
            }

            if (countHandledException != 3)
            {
                Assert.Fail("Должно быть обработано 3 исключения, а обработано: " + countHandledException);
            }
        }
Exemplo n.º 3
0
        public void LoadNotificationComplete()
        {
            bool loadNotificationComplete = false;

            var runner = new AsyncRunner <string>();

            runner.RegisterFunction(() => "HELLO WORLD!");
            runner.LoadCompletedNotification.Subscribe(
                res =>
            {
                loadNotificationComplete = true;
                Assert.That(res, Is.EqualTo("HELLO WORLD!"));
            });

            runner.Wait();

            Assert.That(loadNotificationComplete == true);
        }