mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 09:28:48 +00:00
test: suppress CA1307 and add StringComparison overload calls
This commit is contained in:
parent
43d2e8feea
commit
2fb91d5175
@ -164,7 +164,9 @@ internal class StringTests
|
|||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.That("Hello World".CountSubstring('E'), Is.Zero);
|
Assert.That("Hello World".CountSubstring('E'), Is.Zero);
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That("Hello World".CountSubstring("E"), Is.Zero);
|
Assert.That("Hello World".CountSubstring("E"), Is.Zero);
|
||||||
|
#pragma warning restore CA1307
|
||||||
Assert.That("Hello World".CountSubstring("E", StringComparison.OrdinalIgnoreCase), Is.EqualTo(1));
|
Assert.That("Hello World".CountSubstring("E", StringComparison.OrdinalIgnoreCase), Is.EqualTo(1));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -175,7 +177,9 @@ internal class StringTests
|
|||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.That("Hello World".CountSubstring('z'), Is.Zero);
|
Assert.That("Hello World".CountSubstring('z'), Is.Zero);
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That("Hello World".CountSubstring("z"), Is.Zero);
|
Assert.That("Hello World".CountSubstring("z"), Is.Zero);
|
||||||
|
#pragma warning restore CA1307
|
||||||
Assert.That("Hello World".CountSubstring("z", StringComparison.OrdinalIgnoreCase), Is.Zero);
|
Assert.That("Hello World".CountSubstring("z", StringComparison.OrdinalIgnoreCase), Is.Zero);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -186,7 +190,9 @@ internal class StringTests
|
|||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.That("Hello World".CountSubstring('e'), Is.EqualTo(1));
|
Assert.That("Hello World".CountSubstring('e'), Is.EqualTo(1));
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That("Hello World".CountSubstring("e"), Is.EqualTo(1));
|
Assert.That("Hello World".CountSubstring("e"), Is.EqualTo(1));
|
||||||
|
#pragma warning restore CA1307
|
||||||
Assert.That("Hello World".CountSubstring("e", StringComparison.OrdinalIgnoreCase), Is.EqualTo(1));
|
Assert.That("Hello World".CountSubstring("e", StringComparison.OrdinalIgnoreCase), Is.EqualTo(1));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -197,7 +203,9 @@ internal class StringTests
|
|||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.That(string.Empty.CountSubstring('\0'), Is.Zero);
|
Assert.That(string.Empty.CountSubstring('\0'), Is.Zero);
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(string.Empty.CountSubstring(string.Empty), Is.Zero);
|
Assert.That(string.Empty.CountSubstring(string.Empty), Is.Zero);
|
||||||
|
#pragma warning restore CA1307
|
||||||
Assert.That(string.Empty.CountSubstring(string.Empty, StringComparison.OrdinalIgnoreCase), Is.Zero);
|
Assert.That(string.Empty.CountSubstring(string.Empty, StringComparison.OrdinalIgnoreCase), Is.Zero);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -217,7 +225,10 @@ internal class StringTests
|
|||||||
const string value = "Hello Worl";
|
const string value = "Hello Worl";
|
||||||
const char substring = 'd';
|
const char substring = 'd';
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(value.EnsureEndsWith(substring), Is.EqualTo("Hello World"));
|
Assert.That(value.EnsureEndsWith(substring), Is.EqualTo("Hello World"));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(value.EnsureEndsWith(substring, StringComparison.Ordinal), Is.EqualTo("Hello World"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -226,7 +237,10 @@ internal class StringTests
|
|||||||
const string value = "A";
|
const string value = "A";
|
||||||
const char substring = 'A';
|
const char substring = 'A';
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(value.EnsureEndsWith(substring), Is.EqualTo(value));
|
Assert.That(value.EnsureEndsWith(substring), Is.EqualTo(value));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(value.EnsureEndsWith(substring, StringComparison.Ordinal), Is.EqualTo(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -235,7 +249,10 @@ internal class StringTests
|
|||||||
const string value = "B";
|
const string value = "B";
|
||||||
const char substring = 'A';
|
const char substring = 'A';
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(value.EnsureStartsWith(substring), Is.EqualTo("AB"));
|
Assert.That(value.EnsureStartsWith(substring), Is.EqualTo("AB"));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(value.EnsureStartsWith(substring, StringComparison.Ordinal), Is.EqualTo("AB"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -244,7 +261,10 @@ internal class StringTests
|
|||||||
const string value = "A";
|
const string value = "A";
|
||||||
const char substring = 'A';
|
const char substring = 'A';
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(value.EnsureStartsWith(substring), Is.EqualTo(value));
|
Assert.That(value.EnsureStartsWith(substring), Is.EqualTo(value));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(value.EnsureStartsWith(substring, StringComparison.Ordinal), Is.EqualTo(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -253,7 +273,10 @@ internal class StringTests
|
|||||||
const string value = "Hello ";
|
const string value = "Hello ";
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(value.EnsureEndsWith(substring), Is.EqualTo("Hello World"));
|
Assert.That(value.EnsureEndsWith(substring), Is.EqualTo("Hello World"));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(value.EnsureEndsWith(substring, StringComparison.Ordinal), Is.EqualTo("Hello World"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -261,7 +284,10 @@ internal class StringTests
|
|||||||
{
|
{
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(substring.EnsureEndsWith(substring), Is.EqualTo(substring));
|
Assert.That(substring.EnsureEndsWith(substring), Is.EqualTo(substring));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(substring.EnsureEndsWith(substring, StringComparison.Ordinal), Is.EqualTo(substring));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -269,7 +295,10 @@ internal class StringTests
|
|||||||
{
|
{
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(string.Empty.EnsureEndsWith(substring), Is.EqualTo(substring));
|
Assert.That(string.Empty.EnsureEndsWith(substring), Is.EqualTo(substring));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(string.Empty.EnsureEndsWith(substring, StringComparison.Ordinal), Is.EqualTo(substring));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -277,7 +306,10 @@ internal class StringTests
|
|||||||
{
|
{
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(substring.EnsureEndsWith(string.Empty), Is.EqualTo(substring));
|
Assert.That(substring.EnsureEndsWith(string.Empty), Is.EqualTo(substring));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(substring.EnsureEndsWith(string.Empty, StringComparison.Ordinal), Is.EqualTo(substring));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -286,7 +318,10 @@ internal class StringTests
|
|||||||
const string value = "World";
|
const string value = "World";
|
||||||
const string substring = "Hello ";
|
const string substring = "Hello ";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(value.EnsureStartsWith(substring), Is.EqualTo("Hello World"));
|
Assert.That(value.EnsureStartsWith(substring), Is.EqualTo("Hello World"));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(value.EnsureStartsWith(substring, StringComparison.Ordinal), Is.EqualTo("Hello World"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -294,7 +329,10 @@ internal class StringTests
|
|||||||
{
|
{
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(substring.EnsureStartsWith(substring), Is.EqualTo(substring));
|
Assert.That(substring.EnsureStartsWith(substring), Is.EqualTo(substring));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(substring.EnsureStartsWith(substring, StringComparison.Ordinal), Is.EqualTo(substring));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -302,7 +340,10 @@ internal class StringTests
|
|||||||
{
|
{
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(string.Empty.EnsureStartsWith(substring), Is.EqualTo(substring));
|
Assert.That(string.Empty.EnsureStartsWith(substring), Is.EqualTo(substring));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(string.Empty.EnsureStartsWith(substring, StringComparison.Ordinal), Is.EqualTo(substring));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -310,7 +351,10 @@ internal class StringTests
|
|||||||
{
|
{
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(substring.EnsureStartsWith(string.Empty), Is.EqualTo(substring));
|
Assert.That(substring.EnsureStartsWith(string.Empty), Is.EqualTo(substring));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(substring.EnsureStartsWith(string.Empty, StringComparison.Ordinal), Is.EqualTo(substring));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
Loading…
Reference in New Issue
Block a user