Ejemplo n.º 1
0
        public void PolicyExecutesThePassedDelegate()
        {
            bool executed            = false;
            ReactiveFooPolicy policy = Policy.Handle <Exception>().ReactiveFoo();

            policy.Execute(() => executed = true);

            executed.Should().BeTrue();
        }
        public void ReplaceMeWithRealTests()
        {
            /*
             * This test is for illustrative purposes, to show the interfaces a typical synchronous generic policy fulfills.
             * Real tests should check policy behaviour.
             */
            ReactiveFooPolicy <int> policy = Policy <int> .Handle <Exception>().ReactiveFoo();

            policy.Should().BeAssignableTo <ISyncPolicy <int> >();
            policy.Should().BeAssignableTo <IReactiveFooPolicy <int> >();
        }
        public void PolicyExecutesThePassedDelegate()
        {
            bool executed = false;
            ReactiveFooPolicy <int> policy = Policy <int> .Handle <Exception>().ReactiveFoo();

            policy.Execute(() =>
            {
                executed = true;
                return(default(int));
            });

            executed.Should().BeTrue();
        }