Exemple #1
0
        /*public void Assert<T>(OneParamAssertTypes AssertType, T param, AssertionInfo assertion)
         * {
         *      IAssertable assert = getAssertFromParams(AssertType, param, assertion);
         *      var result = GetAssertResult(assert, assertion);
         *      Assertions.Add(result);
         * }
         *
         *
         * public void Assert<T>(TwoParamsAssertTypes AssertType, T firstParam, T secondParam, AssertionInfo assertion)
         * {
         *      IAssertable assert = getAssertFromParams(AssertType, firstParam, secondParam, assertion);
         *      var result = GetAssertResult(assert, assertion);
         *      Assertions.Add(result);
         * }
         *
         * public void Assert<T>(TwoParamsAssertWithDeltaTypes AssertType, double firstParam, double secondParam, double delta, AssertionInfo assertion)
         * {
         *      IAssertable assert = getAssertFromParams(AssertType, firstParam, secondParam, delta, assertion);
         *      var result = GetAssertResult(assert, assertion);
         *      Assertions.Add(result);
         * }
         *
         *
         * public void Assert(ZeroParamAssertTypes AssertType, AssertionInfo assertion)
         * {
         *      IAssertable assert = getAssertFromParams(AssertType, assertion);
         *      var result = GetAssertResult(assert, assertion);
         *      Assertions.Add(result);
         * }*/

        protected AssertionResult GetAssertResult(IAssertable assert, AssertionInfo assertion)
        {
            var exception = DoAssert(assert);

            if (exception == null)
            {
                assertion.Result = AssertionResults.Passed;
                return(new AssertionResult(assert, assertion));
            }
            else
            {
                assertion.Result          = AssertionResults.Failed;
                assertion.AssertException = exception;
                ThrowExceptionIfNeeded(Settings.IsSoftAssertEnabled, exception);
                return(new AssertionResult(assert, assertion));
            }
        }
Exemple #2
0
 public AssertionResult(IAssertable assert, AssertionInfo assertionInfo)
 {
     Assert        = assert;
     AssertionInfo = assertionInfo;
 }