Skip to content

Commit c37595f

Browse files
authored
Merge pull request #4346 from stevenaw/4246-fix-cultures-v3
V3 | Add tests for test assembly builder in a few cultures + fix underlying culture issues
2 parents 9e7faeb + 4af7eab commit c37595f

File tree

14 files changed

+86
-18
lines changed

14 files changed

+86
-18
lines changed

src/NUnitFramework/framework/Api/DefaultTestAssemblyBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private TestSuite Build(Assembly assembly, string assemblyNameOrPath, IDictionar
148148
if (!string.IsNullOrEmpty(parameters))
149149
foreach (string param in parameters.Split(new[] { ';' }))
150150
{
151-
int eq = param.IndexOf("=");
151+
int eq = param.IndexOf('=');
152152

153153
if (eq > 0 && eq < param.Length - 1)
154154
{

src/NUnitFramework/framework/Attributes/CategoryAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public CategoryAttribute(string name)
6767
protected CategoryAttribute()
6868
{
6969
this.categoryName = this.GetType().Name;
70-
if ( categoryName.EndsWith( "Attribute" ) )
70+
if ( categoryName.EndsWith( "Attribute", StringComparison.Ordinal ) )
7171
categoryName = categoryName.Substring( 0, categoryName.Length - 9 );
7272
}
7373

src/NUnitFramework/framework/Attributes/CombiningStrategyAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public IEnumerable<TestMethod> BuildFrom(IMethodInfo method, Test? suite)
119119
public void ApplyToTest(Test test)
120120
{
121121
var joinType = _strategy.GetType().Name;
122-
if (joinType.EndsWith("Strategy"))
122+
if (joinType.EndsWith("Strategy", StringComparison.Ordinal))
123123
joinType = joinType.Substring(0, joinType.Length - 8);
124124

125125
test.Properties.Set(PropertyNames.JoinType, joinType);

src/NUnitFramework/framework/Attributes/PropertyAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected PropertyAttribute() { }
8484
protected PropertyAttribute( object propertyValue )
8585
{
8686
string propertyName = this.GetType().Name;
87-
if ( propertyName.EndsWith( "Attribute" ) )
87+
if ( propertyName.EndsWith( "Attribute", StringComparison.Ordinal ) )
8888
propertyName = propertyName.Substring( 0, propertyName.Length - 9 );
8989
this.properties.Add(propertyName, propertyValue);
9090
}

src/NUnitFramework/framework/Constraints/PredicateConstraint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public override string Description
5252
get
5353
{
5454
var name = predicate.GetMethodInfo().Name;
55-
return name.StartsWith("<")
55+
return name.StartsWith("<", StringComparison.Ordinal)
5656
? "value matching lambda expression"
5757
: "value matching " + name;
5858
}

src/NUnitFramework/framework/Constraints/UniqueItemsConstraint.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private ICollection OriginalAlgorithm(IEnumerable actual)
149149
private static bool IsSpecialComparisonType(Type type)
150150
{
151151
if (type.IsGenericType)
152-
return type.FullName.StartsWith("System.Collections.Generic.KeyValuePair`2");
152+
return type.FullName.StartsWith("System.Collections.Generic.KeyValuePair`2", StringComparison.Ordinal);
153153
#pragma warning disable CS0618 // 'Numerics' is only marked as obsolete for public use
154154
else if (Numerics.IsNumericType(type))
155155
#pragma warning restore CS0618
@@ -257,7 +257,7 @@ private static bool IsHandledSpeciallyByNUnit(Type type)
257257
{
258258
foreach (var type in actual.GetType().GetInterfaces())
259259
{
260-
if (type.FullName.StartsWith("System.Collections.Generic.IEnumerable`1"))
260+
if (type.FullName.StartsWith("System.Collections.Generic.IEnumerable`1", StringComparison.Ordinal))
261261
{
262262
#if NET35 || NET40
263263
return type.GetGenericArguments()[0];

src/NUnitFramework/framework/Interfaces/TNode.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ private static NodeList ApplySelection(NodeList nodeList, string xpath)
274274
Guard.ArgumentNotNullOrEmpty(xpath, nameof(xpath));
275275
if (xpath[0] == '/')
276276
throw new ArgumentException("XPath expressions starting with '/' are not supported", nameof(xpath));
277-
if (xpath.IndexOf("//") >= 0)
277+
if (xpath.IndexOf("//", StringComparison.Ordinal) >= 0)
278278
throw new ArgumentException("XPath expressions with '//' are not supported", nameof(xpath));
279279

280280
string head = xpath;
@@ -378,7 +378,7 @@ private void WriteCDataTo(XmlWriter writer)
378378

379379
while (true)
380380
{
381-
int illegal = text.IndexOf("]]>", start);
381+
int illegal = text.IndexOf("]]>", start, StringComparison.Ordinal);
382382
if (illegal < 0)
383383
break;
384384
writer.WriteCData(text.Substring(start, illegal - start + 2));
@@ -410,7 +410,7 @@ public NodeFilter(string xpath)
410410
int lbrack = xpath.IndexOf('[');
411411
if (lbrack >= 0)
412412
{
413-
if (!xpath.EndsWith("]"))
413+
if (!xpath.EndsWith("]", StringComparison.Ordinal))
414414
throw new ArgumentException("Invalid property expression", nameof(xpath));
415415

416416
_nodeName = xpath.Substring(0, lbrack);

src/NUnitFramework/framework/Internal/Builders/NUnitTestCaseBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public TestMethod BuildTestMethod(IMethodInfo method, Test? parentSuite, TestCas
8787
if (parms.TestName != null)
8888
{
8989
// The test is simply for efficiency
90-
testMethod.Name = parms.TestName.Contains("{")
90+
testMethod.Name = parms.TestName.IndexOf('{') >= 0
9191
? new TestNameGenerator(parms.TestName).GetDisplayName(testMethod, parms.OriginalArguments)
9292
: parms.TestName;
9393
}

src/NUnitFramework/framework/Internal/Builders/NamespaceTreeBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private TestSuite GetNamespaceSuite( string ns )
123123
return _namespaceIndex[ns];
124124

125125
TestSuite suite;
126-
int index = ns.LastIndexOf(".");
126+
int index = ns.LastIndexOf('.');
127127

128128
if( index == -1 )
129129
{

src/NUnitFramework/framework/Internal/Reflect.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ internal static bool CanImplicitlyConvertTo(this Type? from, Type to)
178178
if (from == null)
179179
{
180180
// Look for the marker that indicates from was null
181-
return to.GetTypeInfo().IsClass || to.FullName.StartsWith("System.Nullable");
181+
return to.GetTypeInfo().IsClass || to.FullName.StartsWith("System.Nullable", StringComparison.Ordinal);
182182
}
183183

184184
if (convertibleValueTypes.ContainsKey(to) && convertibleValueTypes[to].Contains(from))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy