Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
247 changes: 165 additions & 82 deletions src/TestFramework/TestFramework/Assertions/Assert.Contains.cs

Large diffs are not rendered by default.

29 changes: 0 additions & 29 deletions src/TestFramework/TestFramework/Assertions/Assert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,29 +272,12 @@ private static string BuildUserMessageForTwoExpressions(string? format, string c
: $"{callerArgMessagePart} {userMessage}";
}

private static string BuildUserMessageForThreeExpressions(string? format, string callerArgExpression1, string parameterName1, string callerArgExpression2, string parameterName2, string callerArgExpression3, string parameterName3)
{
string userMessage = BuildUserMessage(format);
if (string.IsNullOrEmpty(callerArgExpression1) || string.IsNullOrEmpty(callerArgExpression2) || string.IsNullOrEmpty(callerArgExpression3))
{
return userMessage;
}

string callerArgMessagePart = string.Format(CultureInfo.InvariantCulture, FrameworkMessages.CallerArgumentExpressionThreeParametersMessage, parameterName1, callerArgExpression1, parameterName2, callerArgExpression2, parameterName3, callerArgExpression3);
return string.IsNullOrEmpty(userMessage)
? callerArgMessagePart
: $"{callerArgMessagePart} {userMessage}";
}

private static string BuildUserMessageForValueExpression(string? format, string valueExpression)
=> BuildUserMessageForSingleExpression(format, valueExpression, "value");

private static string BuildUserMessageForCollectionExpression(string? format, string collectionExpression)
=> BuildUserMessageForSingleExpression(format, collectionExpression, "collection");

private static string BuildUserMessageForSubstringExpressionAndValueExpression(string? format, string substringExpression, string valueExpression)
=> BuildUserMessageForTwoExpressions(format, substringExpression, "substring", valueExpression, "value");

private static string BuildUserMessageForExpectedSuffixExpressionAndValueExpression(string? format, string expectedSuffixExpression, string valueExpression)
=> BuildUserMessageForTwoExpressions(format, expectedSuffixExpression, "expectedSuffix", valueExpression, "value");

Expand All @@ -316,24 +299,12 @@ private static string BuildUserMessageForLowerBoundExpressionAndValueExpression(
private static string BuildUserMessageForUpperBoundExpressionAndValueExpression(string? format, string upperBoundExpression, string valueExpression)
=> BuildUserMessageForTwoExpressions(format, upperBoundExpression, "upperBound", valueExpression, "value");

private static string BuildUserMessageForExpectedExpressionAndCollectionExpression(string? format, string expectedExpression, string collectionExpression)
=> BuildUserMessageForTwoExpressions(format, expectedExpression, "expected", collectionExpression, "collection");

private static string BuildUserMessageForNotExpectedExpressionAndCollectionExpression(string? format, string notExpectedExpression, string collectionExpression)
=> BuildUserMessageForTwoExpressions(format, notExpectedExpression, "notExpected", collectionExpression, "collection");

private static string BuildUserMessageForPredicateExpressionAndCollectionExpression(string? format, string predicateExpression, string collectionExpression)
=> BuildUserMessageForTwoExpressions(format, predicateExpression, "predicate", collectionExpression, "collection");

private static string BuildUserMessageForExpectedExpressionAndActualExpression(string? format, string expectedExpression, string actualExpression)
=> BuildUserMessageForTwoExpressions(format, expectedExpression, "expected", actualExpression, "actual");

private static string BuildUserMessageForNotExpectedExpressionAndActualExpression(string? format, string notExpectedExpression, string actualExpression)
=> BuildUserMessageForTwoExpressions(format, notExpectedExpression, "notExpected", actualExpression, "actual");

private static string BuildUserMessageForMinValueExpressionAndMaxValueExpressionAndValueExpression(string? format, string minValueExpression, string maxValueExpression, string valueExpression)
=> BuildUserMessageForThreeExpressions(format, minValueExpression, "minValue", maxValueExpression, "maxValue", valueExpression, "value");

/// <summary>
/// Checks the parameter for valid conditions.
/// </summary>
Expand Down
27 changes: 27 additions & 0 deletions src/TestFramework/TestFramework/Resources/FrameworkMessages.resx
Original file line number Diff line number Diff line change
Expand Up @@ -420,4 +420,31 @@ Actual: {2}</value>
<data name="IsNotNullFailedSummary" xml:space="preserve">
<value>Expected value to not be null.</value>
</data>
<data name="ContainsSingleFailedSummary" xml:space="preserve">
<value>Expected collection to contain exactly one element.</value>
</data>
<data name="ContainsSingleMatchFailedSummary" xml:space="preserve">
<value>Expected collection to contain exactly one element matching the predicate.</value>
</data>
<data name="ContainsItemFailedSummary" xml:space="preserve">
<value>Expected collection to contain the specified element.</value>
</data>
<data name="ContainsPredicateFailedSummary" xml:space="preserve">
<value>Expected collection to contain an element matching the predicate.</value>
</data>
<data name="ContainsSubstringFailedSummary" xml:space="preserve">
<value>Expected string to contain the specified substring.</value>
</data>
<data name="DoesNotContainItemFailedSummary" xml:space="preserve">
<value>Expected collection to not contain the specified element.</value>
</data>
<data name="DoesNotContainPredicateFailedSummary" xml:space="preserve">
<value>Expected collection to not contain an element matching the predicate.</value>
</data>
<data name="DoesNotContainSubstringFailedSummary" xml:space="preserve">
<value>Expected string to not contain the specified substring.</value>
</data>
<data name="IsInRangeFailedSummary" xml:space="preserve">
<value>Expected value to be within the inclusive range.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -168,21 +168,46 @@
<target state="translated">Očekávala se kolekce, která bude obsahovat zadanou položku. {0}</target>
<note />
</trans-unit>
<trans-unit id="ContainsItemFailedSummary">
<source>Expected collection to contain the specified element.</source>
<target state="new">Expected collection to contain the specified element.</target>
<note />
</trans-unit>
<trans-unit id="ContainsPredicateFailMsg">
<source>Expected at least one item to match the predicate. {0}</source>
<target state="translated">Očekávala se alespoň jedna položka odpovídající predikátu. {0}</target>
<note />
</trans-unit>
<trans-unit id="ContainsPredicateFailedSummary">
<source>Expected collection to contain an element matching the predicate.</source>
<target state="new">Expected collection to contain an element matching the predicate.</target>
<note />
</trans-unit>
<trans-unit id="ContainsSingleFailMsg">
<source>Expected collection to contain exactly one element but found {1} element(s). {0}</source>
<target state="translated">Očekávalo se, že kolekce bude obsahovat přesně jeden prvek, ale našlo se tolik elementů: {1}. {0}</target>
<note />
</trans-unit>
<trans-unit id="ContainsSingleFailedSummary">
<source>Expected collection to contain exactly one element.</source>
<target state="new">Expected collection to contain exactly one element.</target>
<note />
</trans-unit>
<trans-unit id="ContainsSingleMatchFailMsg">
<source>Expected exactly one item to match the predicate but found {1} item(s). {0}</source>
<target state="translated">Očekávala se přesně jedna položka odpovídající predikátu, ale našlo se tolik položek: {1}. {0}</target>
<note />
</trans-unit>
<trans-unit id="ContainsSingleMatchFailedSummary">
<source>Expected collection to contain exactly one element matching the predicate.</source>
<target state="new">Expected collection to contain exactly one element matching the predicate.</target>
<note />
</trans-unit>
<trans-unit id="ContainsSubstringFailedSummary">
<source>Expected string to contain the specified substring.</source>
<target state="new">Expected string to contain the specified substring.</target>
<note />
</trans-unit>
<trans-unit id="DoesNotContainFail">
<source>String '{0}' does contain string '{1}'. {2}.</source>
<target state="translated">Řetězec {0} obsahuje řetězec {1}. {2}.</target>
Expand All @@ -193,11 +218,26 @@
<target state="translated">Očekávalo se, že kolekce nebude obsahovat zadanou položku. {0}</target>
<note />
</trans-unit>
<trans-unit id="DoesNotContainItemFailedSummary">
<source>Expected collection to not contain the specified element.</source>
<target state="new">Expected collection to not contain the specified element.</target>
<note />
</trans-unit>
<trans-unit id="DoesNotContainPredicateFailMsg">
<source>Expected no items to match the predicate. {0}</source>
<target state="translated">Očekávaly se žádné položky, které by odpovídaly predikátu. {0}</target>
<note />
</trans-unit>
<trans-unit id="DoesNotContainPredicateFailedSummary">
<source>Expected collection to not contain an element matching the predicate.</source>
<target state="new">Expected collection to not contain an element matching the predicate.</target>
<note />
</trans-unit>
<trans-unit id="DoesNotContainSubstringFailedSummary">
<source>Expected string to not contain the specified substring.</source>
<target state="new">Expected string to not contain the specified substring.</target>
<note />
</trans-unit>
<trans-unit id="DoesNotEndWithFail">
<source>String '{0}' ends with string '{1}'. {2}</source>
<target state="translated">Řetězec „{0}“ končí řetězcem „{1}“. {2}</target>
Expand Down Expand Up @@ -282,6 +322,11 @@ Skutečnost: {2}</target>
<target state="translated">Hodnota {0} není v očekávaném rozsahu [{1}..{2}]. {3}</target>
<note />
</trans-unit>
<trans-unit id="IsInRangeFailedSummary">
<source>Expected value to be within the inclusive range.</source>
<target state="new">Expected value to be within the inclusive range.</target>
<note />
</trans-unit>
<trans-unit id="IsInRangeMaxValueMustBeGreaterThanOrEqualMinValue">
<source>The maximum value must be greater than or equal to the minimum value.</source>
<target state="translated">Maximální hodnota musí být větší nebo rovna minimální hodnotě.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,21 +168,46 @@
<target state="translated">Es wurde erwartet, dass die Sammlung das angegebene Element enthält. {0}</target>
<note />
</trans-unit>
<trans-unit id="ContainsItemFailedSummary">
<source>Expected collection to contain the specified element.</source>
<target state="new">Expected collection to contain the specified element.</target>
<note />
</trans-unit>
<trans-unit id="ContainsPredicateFailMsg">
<source>Expected at least one item to match the predicate. {0}</source>
<target state="translated">Es wurde erwartet, dass mindestens ein Element mit dem Prädikat übereinstimmt. {0}</target>
<note />
</trans-unit>
<trans-unit id="ContainsPredicateFailedSummary">
<source>Expected collection to contain an element matching the predicate.</source>
<target state="new">Expected collection to contain an element matching the predicate.</target>
<note />
</trans-unit>
<trans-unit id="ContainsSingleFailMsg">
<source>Expected collection to contain exactly one element but found {1} element(s). {0}</source>
<target state="translated">Es wurde erwartet, dass die Sammlung genau ein Element enthält, es wurden jedoch {1} gefunden. {0}</target>
<note />
</trans-unit>
<trans-unit id="ContainsSingleFailedSummary">
<source>Expected collection to contain exactly one element.</source>
<target state="new">Expected collection to contain exactly one element.</target>
<note />
</trans-unit>
<trans-unit id="ContainsSingleMatchFailMsg">
<source>Expected exactly one item to match the predicate but found {1} item(s). {0}</source>
<target state="translated">Es wurde erwartet, dass genau ein Element mit dem Prädikat übereinstimmt, es wurden jedoch {1} Element(e) gefunden. {0}</target>
<note />
</trans-unit>
<trans-unit id="ContainsSingleMatchFailedSummary">
<source>Expected collection to contain exactly one element matching the predicate.</source>
<target state="new">Expected collection to contain exactly one element matching the predicate.</target>
<note />
</trans-unit>
<trans-unit id="ContainsSubstringFailedSummary">
<source>Expected string to contain the specified substring.</source>
<target state="new">Expected string to contain the specified substring.</target>
<note />
</trans-unit>
<trans-unit id="DoesNotContainFail">
<source>String '{0}' does contain string '{1}'. {2}.</source>
<target state="translated">Die Zeichenfolge „{0}“ enthält die Zeichenfolge „{1}“. {2}.</target>
Expand All @@ -193,11 +218,26 @@
<target state="translated">Es wurde erwartet, dass die Sammlung das angegebene Element nicht enthält. {0}</target>
<note />
</trans-unit>
<trans-unit id="DoesNotContainItemFailedSummary">
<source>Expected collection to not contain the specified element.</source>
<target state="new">Expected collection to not contain the specified element.</target>
<note />
</trans-unit>
<trans-unit id="DoesNotContainPredicateFailMsg">
<source>Expected no items to match the predicate. {0}</source>
<target state="translated">Es wurden erwartet, dass keine Elemente mit dem Prädikat übereinstimmen. {0}</target>
<note />
</trans-unit>
<trans-unit id="DoesNotContainPredicateFailedSummary">
<source>Expected collection to not contain an element matching the predicate.</source>
<target state="new">Expected collection to not contain an element matching the predicate.</target>
<note />
</trans-unit>
<trans-unit id="DoesNotContainSubstringFailedSummary">
<source>Expected string to not contain the specified substring.</source>
<target state="new">Expected string to not contain the specified substring.</target>
<note />
</trans-unit>
<trans-unit id="DoesNotEndWithFail">
<source>String '{0}' ends with string '{1}'. {2}</source>
<target state="translated">Die Zeichenfolge „{0}“ endet mit der Zeichenfolge „{1}“. {2}</target>
Expand Down Expand Up @@ -282,6 +322,11 @@ Tatsächlich: {2}</target>
<target state="translated">Der Wert „{0}“ liegt nicht im erwarteten Bereich [{1}..{2}]. {3}</target>
<note />
</trans-unit>
<trans-unit id="IsInRangeFailedSummary">
<source>Expected value to be within the inclusive range.</source>
<target state="new">Expected value to be within the inclusive range.</target>
<note />
</trans-unit>
<trans-unit id="IsInRangeMaxValueMustBeGreaterThanOrEqualMinValue">
<source>The maximum value must be greater than or equal to the minimum value.</source>
<target state="translated">Der Höchstwert muss größer oder gleich dem Mindestwert sein.</target>
Expand Down
Loading
Loading