コード例 #1
0
        public void ThenTryTIn_WhenExecuteIsNull_ThrowsArgumentNullException()
        {
            TryResult <int>       t  = "";
            Func <int, TryResult> t2 = null;

            Assert.Throws <ArgumentNullException>(() => t.ThenTry(t2));
        }
コード例 #2
0
        public void ThenTryTOut_WhenTryFailed_ReturnsOriginalError()
        {
            TryResult t = "err";

            var t2 = t.ThenTry <int>(() => 1);

            Assert.AreEqual(t.ErrorMessage, t2.ErrorMessage);
        }
コード例 #3
0
ファイル: ThenTryTests.cs プロジェクト: phoenix-apps/Phnx
        public void ThenTry_WhenTryFailed_ReturnsOriginalError()
        {
            TryResult t = "err";

            var t2 = t.ThenTry(() => TryResult.Succeed());

            Assert.AreEqual(t, t2);
        }
コード例 #4
0
        public void ThenTryTInTOut_WhenTryFailed_ReturnsOriginalError()
        {
            TryResult <int> t = "err";

            var t2 = t.ThenTry <int, int>(r => 1);

            Assert.AreEqual(t.Result, t2.Result);
        }
コード例 #5
0
        public void ThenTryTIn_WhenTrySucceededAndExecutorSucceeds_ReturnsResultOfOriginalTry()
        {
            TryResult <int> t = 1;

            var tr = t.ThenTry(r => TryResult.Succeed());

            Assert.AreEqual(t, tr);
        }
コード例 #6
0
        public void ThenTryTInTOut_WhenTrySucceededAndExecutorSucceeds_ReturnsResultOfExecutor()
        {
            TryResult <int> t = 1;

            var result = 5;
            var tr     = t.ThenTry <int, int>(r => result);

            Assert.AreEqual(result, tr.Result);
        }
コード例 #7
0
        public void ThenTryTInTOut_WhenTrySucceededAndExecutorFails_ReturnsExecutorError()
        {
            TryResult <int> t = 1;

            var err = "err";
            var tr  = t.ThenTry <int, int>(r => err);

            Assert.AreEqual(err, tr.ErrorMessage);
        }
コード例 #8
0
        public void ThenTryTOut_WhenTryFailed_DoesNotExecute()
        {
            TryResult t = "err";

            var executed = false;

            t.ThenTry <int>(() =>
            {
                executed = true;
                return(1);
            });

            Assert.IsFalse(executed);
        }
コード例 #9
0
ファイル: ThenTryTests.cs プロジェクト: phoenix-apps/Phnx
        public void ThenTry_WhenTryFailed_DoesNotExecute()
        {
            TryResult t = "err";

            var executed = false;

            t.ThenTry(() =>
            {
                executed = true;
                return(TryResult.Succeed());
            });

            Assert.IsFalse(executed);
        }
コード例 #10
0
        public void ThenTryTInTOut_WhenTrySucceeded_Executes()
        {
            TryResult <int> t = 1;

            var executed = false;

            t.ThenTry <int, int>(r =>
            {
                executed = true;
                return(1);
            });

            Assert.IsTrue(executed);
        }
コード例 #11
0
        public void ThenTryTIn_WhenTrySucceeded_Executes()
        {
            TryResult <int> t = 1;

            var executed = false;

            t.ThenTry(() =>
            {
                executed = true;
                return(TryResult.Succeed());
            });

            Assert.IsTrue(executed);
        }
コード例 #12
0
        public void ThenTryTOut_WhenTryResultIsNull_ThrowsArgumentNullException()
        {
            TryResult t = null;

            Assert.Throws <ArgumentNullException>(() => t.ThenTry <int>(() => 1));
        }
コード例 #13
0
        public void ThenTryTOut_WhenExecuteIsNull_ThrowsArgumentNullException()
        {
            TryResult t = "";

            Assert.Throws <ArgumentNullException>(() => t.ThenTry <int>(null));
        }
コード例 #14
0
ファイル: ThenTryTests.cs プロジェクト: phoenix-apps/Phnx
        public void ThenTry_WhenTryResultIsNull_ThrowsArgumentNullException()
        {
            TryResult t = null;

            Assert.Throws <ArgumentNullException>(() => t.ThenTry(() => string.Empty));
        }
コード例 #15
0
        public void ThenTryTIn_WhenExecuteResultIsNull_ThrowsInvalidOperationException()
        {
            TryResult <int> t = 1;

            Assert.Throws <InvalidOperationException>(() => t.ThenTry(r => null));
        }