コード例 #1
0
        public void GenericOkResult_IsSuccessDoesNotThrowException()
        {
            var       result    = ActResult.Ok(0);
            var       underTest = new AssertionRoot <int>(result);
            Exception exception = null;

            try
            {
                underTest.IsSuccess();
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            Assert.IsNull(exception);
        }
コード例 #2
0
        public void GenericErrorResult_IsSuccessThrowsException()
        {
            var       result    = ActResult.ThrewException <int>(new Exception());
            var       underTest = new AssertionRoot <int>(result);
            Exception exception = null;

            try
            {
                underTest.IsSuccess();
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            Assert.IsNotNull(exception);
            Assert.IsInstanceOfType(exception, typeof(AssertFailedException));
        }
コード例 #3
0
        public void ErrorResult_IsSuccessThrowsExceptionWithMessage()
        {
            const string message   = "Should work";
            var          result    = ActResult.ThrewException(new Exception());
            var          underTest = new AssertionRoot(result);
            Exception    exception = null;

            try
            {
                underTest.IsSuccess(message);
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            Assert.IsTrue(exception.Message.Contains(message));
        }