Exemple #1
0
        /* ----------------------------------------------------------------- */
        ///
        /// Test
        ///
        /// <summary>
        /// Tests the main operation.
        /// </summary>
        ///
        /// <param name="src">Source ViewModel.</param>
        /// <param name="callback">Action after starting.</param>
        ///
        /* ----------------------------------------------------------------- */
        public static void Test(this ProgressViewModel src, Action callback)
        {
            var cts = new CancellationTokenSource();

            using (src.Subscribe(e => {
                if (e == nameof(src.State) && src.State == TimerState.Stop)
                {
                    cts.Cancel();
                }
            })) {
                src.Start();
                callback();
                Assert.That(Wait.For(cts.Token), "Timeout");
            }
        }