Пример #1
0
        public void GenericOkResult_ValidationCallbackThrowsException()
        {
            var       result    = ActResult.Ok(1);
            var       underTest = new AssertionRoot <int>(result);
            Exception exception = null;

            try
            {
                underTest.Validate(r => Assert.AreEqual(2, r));
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            Assert.IsNotNull(exception);
            Assert.IsInstanceOfType(exception, typeof(AssertFailedException));
        }
Пример #2
0
        public void GenericErrorResult_ValidateThrowsException()
        {
            var       result    = ActResult.ThrewException <int>(new IOException());
            var       underTest = new AssertionRoot <int>(result);
            Exception exception = null;

            try
            {
                underTest.Validate(r => Assert.AreEqual(1, r));
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            Assert.IsNotNull(exception);
            Assert.IsInstanceOfType(exception, typeof(AssertFailedException));
        }
Пример #3
0
        public void GenericOkResult_ValidationCallbackDoesNotThrowException()
        {
            const int one       = 1;
            var       result    = ActResult.Ok(one);
            var       underTest = new AssertionRoot <int>(result);
            Exception exception = null;

            try
            {
                underTest.Validate(r => Assert.AreEqual(one, r));
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            Assert.IsNull(exception);
        }