Inheritance: IShouldlyAssertionContext
Example #1
0
 public ExpectedActualKeyShouldlyMessage(object expected, object actual, object key)
 {
     ShouldlyAssertionContext     = new ShouldlyAssertionContext(expected, actual);
     ShouldlyAssertionContext.Key = key;
     ShouldlyAssertionContext.HasRelevantActual = true;
     ShouldlyAssertionContext.HasRelevantKey    = true;
 }
Example #2
0
 public ExpectedActualIgnoreOrderShouldlyMessage(object expected, object actual, [InstantHandle] Func<string> customMessage)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(expected, actual);
     ShouldlyAssertionContext.IgnoreOrder = true;
     ShouldlyAssertionContext.HasRelevantActual = true;
     if (customMessage != null) ShouldlyAssertionContext.CustomMessage = customMessage();
 }
Example #3
0
 public ExpectedShouldlyMessage(object expected, [InstantHandle] Func <string> customMessage)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(expected);
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
Example #4
0
 public ExpectedShouldlyMessage(object expected, [InstantHandle] Func <string> customMessage, [CallerMemberName] string shouldlyMethod = null)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, expected);
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
 public ExpectedShouldlyMessage(object?expected, string?customMessage, [CallerMemberName] string shouldlyMethod = null !)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, expected);
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage;
     }
 }
Example #6
0
 public ExpectedActualShouldlyMessage(object expected, object actual, [InstantHandle] Func<string> customMessage, [CallerMemberName] string shouldlyMethod = null)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, expected, actual)
     {
         HasRelevantActual = true
     };
     if (customMessage != null) ShouldlyAssertionContext.CustomMessage = customMessage();
 }
Example #7
0
 public ExpectedActualToleranceShouldlyMessage(object expected, object actual, object tolerance, [InstantHandle] Func<string> customMessage)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(expected, actual)
     {
         Tolerance = tolerance,
         HasRelevantActual = true
     };
     if (customMessage != null) ShouldlyAssertionContext.CustomMessage = customMessage();
 }
Example #8
0
 public ExpectedActualShouldlyMessage(object expected, object actual, Func <string> customMessage)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(expected, actual);
     ShouldlyAssertionContext.HasRelevantActual = true;
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
Example #9
0
 public ActualFilteredWithPredicateShouldlyMessage(Expression filter, object result, object actual, [InstantHandle] Func<string> customMessage, [CallerMemberName] string shouldlyMethod = null)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, result, actual)
     {
         HasRelevantActual = true,
         Filter = filter
     };
     if (customMessage != null) ShouldlyAssertionContext.CustomMessage = customMessage();
 }
Example #10
0
 public CompleteInShouldlyMessage(string what, TimeSpan timeout, Func <string> customMessage)
 {
     ShouldlyAssertionContext         = new ShouldlyAssertionContext(what);
     ShouldlyAssertionContext.Timeout = timeout;
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
Example #11
0
 public ExpectedActualKeyShouldlyMessage(object expected, object actual, object key, [InstantHandle] Func<string> customMessage)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(expected, actual)
     {
         Key = key,
         HasRelevantActual = true,
         HasRelevantKey = true
     };
     if (customMessage != null) ShouldlyAssertionContext.CustomMessage = customMessage();
 }
Example #12
0
 public ExpectedActualIgnoreOrderShouldlyMessage(object expected, object actual, [InstantHandle] Func <string> customMessage)
 {
     ShouldlyAssertionContext                   = new ShouldlyAssertionContext(expected, actual);
     ShouldlyAssertionContext.IgnoreOrder       = true;
     ShouldlyAssertionContext.HasRelevantActual = true;
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
 public ExpectedActualShouldlyMessage(object?expected, object?actual, string?customMessage, [CallerMemberName] string shouldlyMethod = null !)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, expected, actual)
     {
         HasRelevantActual = true
     };
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage;
     }
 }
Example #14
0
 public ExpectedEquvalenceShouldlyMessage(object expected, object actual, IEnumerable <string> path, [InstantHandle] Func <string> customMessage, [CallerMemberName] string shouldlyMethod = null)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, expected, actual)
     {
         Path = path
     };
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
 public ExpectedEquivalenceShouldlyMessage(object?expected, object?actual, IEnumerable <string> path, string?customMessage, [CallerMemberName] string shouldlyMethod = null !)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, expected, actual)
     {
         Path = path
     };
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage;
     }
 }
Example #16
0
 public ExpectedActualShouldlyMessage(object expected, object actual, [InstantHandle] Func <string> customMessage, [CallerMemberName] string shouldlyMethod = null)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, expected, actual)
     {
         HasRelevantActual = true
     };
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
Example #17
0
 public ExpectedActualToleranceShouldlyMessage(object expected, object actual, object tolerance, [InstantHandle] Func <string> customMessage)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(expected, actual)
     {
         Tolerance         = tolerance,
         HasRelevantActual = true
     };
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
Example #18
0
 public ExpectedActualWithCaseSensitivityShouldlyMessage(object expected, object actual, Case?caseSensitivity, [InstantHandle] Func <string> customMessage)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(expected, actual)
     {
         HasRelevantActual = true,
         CaseSensitivity   = caseSensitivity
     };
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
Example #19
0
 public ActualFilteredWithPredicateShouldlyMessage(Expression filter, object result, object actual, [InstantHandle] Func <string> customMessage, [CallerMemberName] string shouldlyMethod = null)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, result, actual)
     {
         HasRelevantActual = true,
         Filter            = filter
     };
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
Example #20
0
 public ShouldContainWithCountShouldlyMessage(object expected, object actual, int matchCount, [InstantHandle] Func <string> customMessage, [CallerMemberName] string shouldlyMethod = null)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, expected, actual)
     {
         HasRelevantActual = true,
         MatchCount        = matchCount
     };
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
Example #21
0
 public CompleteInShouldlyMessage(string what, TimeSpan timeout,
                                  [InstantHandle] Func <string> customMessage,
                                  [CallerMemberName] string shouldlyMethod = null)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, what)
     {
         Timeout = timeout
     };
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
Example #22
0
 public ExpectedActualKeyShouldlyMessage(object expected, object actual, object key, [InstantHandle] Func <string> customMessage)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(expected, actual)
     {
         Key = key,
         HasRelevantActual = true,
         HasRelevantKey    = true
     };
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
Example #23
0
 public ExpectedActualToleranceShouldlyMessage(object?expected, object?actual, object tolerance,
                                               [InstantHandle] Func <string?>?customMessage,
                                               [CallerMemberName] string shouldlyMethod = null !)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, expected, actual)
     {
         Tolerance         = tolerance,
         HasRelevantActual = true
     };
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
Example #24
0
 public ExpectedActualWithCaseSensitivityShouldlyMessage(object?expected, object?actual,
                                                         Case?caseSensitivity,
                                                         [InstantHandle] Func <string?>?customMessage,
                                                         [CallerMemberName] string shouldlyMethod = null !)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, expected, actual)
     {
         HasRelevantActual = true,
         CaseSensitivity   = caseSensitivity
     };
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
Example #25
0
 public ExpectedOrderShouldlyMessage(object actual, SortDirection expectedDirection, int outOfOrderIndex, object outOfOrderObject,
                                     [InstantHandle] Func <string> customMessage,
                                     [CallerMemberName] string shouldlyMethod = null)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, actual: actual)
     {
         SortDirection    = expectedDirection,
         OutOfOrderIndex  = outOfOrderIndex,
         OutOfOrderObject = outOfOrderObject
     };
     if (customMessage != null)
     {
         ShouldlyAssertionContext.CustomMessage = customMessage();
     }
 }
Example #26
0
        private string CreateActualVsExpectedMessage(ShouldlyAssertionContext context)
        {
            var    codePart = context.CodePart;
            string message  = string.Format(@"
    {0}
        {1}
    {2}
        but was
    {3}",
                                            codePart, context.ShouldMethod.PascalToSpaced(), context.Expected.Inspect(), context.Actual.Inspect());

            if (DifferenceHighlighterExtensions.CanGenerateDifferencesBetween(context))
            {
                message += string.Format(@"
        difference
    {0}",
                                         DifferenceHighlighterExtensions.HighlightDifferencesBetween(context));
            }
            return(message);
        }
Example #27
0
        private string CreateActualVsExpectedMessage(ShouldlyAssertionContext context)
        {
            var    codePart = context.CodePart;
            string message  = string.Format(@"
    {0}
        {1}
    {2}
        but was
    {3}",
                                            codePart, context.ShouldMethod.PascalToSpaced(), context.Expected.ToStringAwesomely(), context.Actual.ToStringAwesomely());

            if (DifferenceHighlighter.CanHighlightDifferences(context))
            {
                message += string.Format(@"
        difference
    {0}",
                                         DifferenceHighlighter.HighlightDifferences(context));
            }
            return(message);
        }
Example #28
0
 public ExpectedShouldlyMessage(object expected)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(expected);
 }
Example #29
0
 public CompleteInShouldlyMessage(string what, TimeSpan timeout, [InstantHandle] Func<string> customMessage)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(what)
     {
         Timeout = timeout
     };
     if (customMessage != null) ShouldlyAssertionContext.CustomMessage = customMessage();
 }
Example #30
0
 public ExpectedShouldlyMessage(object expected, [InstantHandle] Func<string> customMessage, [CallerMemberName] string shouldlyMethod = null)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, expected);
     if (customMessage != null) ShouldlyAssertionContext.CustomMessage = customMessage();
 }
Example #31
0
 public CompleteInShouldlyMessage(string what, TimeSpan timeout,
     [InstantHandle] Func<string> customMessage,
     [CallerMemberName] string shouldlyMethod = null)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, what)
     {
         Timeout = timeout
     };
     if (customMessage != null) ShouldlyAssertionContext.CustomMessage = customMessage();
 }
Example #32
0
 public ExpectedActualShouldlyMessage(object expected, object actual)
 {
     ShouldlyAssertionContext           = new ShouldlyAssertionContext(expected, actual);
     ShouldlyAssertionContext.HasActual = true;
 }
Example #33
0
 public ExpectedActualIgnoreOrderShouldlyMessage(object expected, object actual)
 {
     ShouldlyAssertionContext                   = new ShouldlyAssertionContext(expected, actual);
     ShouldlyAssertionContext.IgnoreOrder       = true;
     ShouldlyAssertionContext.HasRelevantActual = true;
 }
Example #34
0
 public ExpectedActualToleranceShouldlyMessage(object expected, object actual, object tolerance)
 {
     ShouldlyAssertionContext                   = new ShouldlyAssertionContext(expected, actual);
     ShouldlyAssertionContext.Tolerance         = tolerance;
     ShouldlyAssertionContext.HasRelevantActual = true;
 }
Example #35
0
 public ExpectedActualWithCaseSensitivityShouldlyMessage(object expected, object actual, Case? caseSensitivity, [InstantHandle] Func<string> customMessage)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(expected, actual)
     {
         HasRelevantActual = true,
         CaseSensitivity = caseSensitivity
     };
     if (customMessage != null) ShouldlyAssertionContext.CustomMessage = customMessage();
 }
Example #36
0
 public ExpectedOrderShouldlyMessage(object actual, SortDirection expectedDirection, int outOfOrderIndex, object outOfOrderObject,
     [InstantHandle] Func<string> customMessage,
     [CallerMemberName] string shouldlyMethod = null)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, actual: actual)
     {
         SortDirection = expectedDirection,
         OutOfOrderIndex = outOfOrderIndex,
         OutOfOrderObject = outOfOrderObject
     };
     if (customMessage != null) ShouldlyAssertionContext.CustomMessage = customMessage();
 }
Example #37
0
 public ShouldContainWithCountShouldlyMessage(object expected, object actual, int matchCount, [InstantHandle] Func<string> customMessage, [CallerMemberName] string shouldlyMethod = null)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(shouldlyMethod, expected, actual)
     {
         HasRelevantActual = true,
         MatchCount = matchCount
     };
     if (customMessage != null) ShouldlyAssertionContext.CustomMessage = customMessage();
 }
Example #38
0
 public ExpectedShouldlyMessage(object expected, [InstantHandle] Func<string> customMessage)
 {
     ShouldlyAssertionContext = new ShouldlyAssertionContext(expected);
     if (customMessage != null) ShouldlyAssertionContext.CustomMessage = customMessage();
 }