1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-22 19:58:49 +00:00

[ci skip] Use explicit type in tests

This commit is contained in:
Oliver Booth 2022-04-20 17:31:16 +01:00
parent 928fa64ba4
commit 2128814db1
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
3 changed files with 16 additions and 13 deletions

View File

@ -1,4 +1,4 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace X10D.Tests.Core
{
@ -20,8 +20,11 @@ namespace X10D.Tests.Core
var trueBytes = new byte[] { 0x01 };
var falseBytes = new byte[] { 0x00 };
var trueResult = trueValue.GetBytes();
var falseResult = falseValue.GetBytes();
byte[] trueResult = trueValue.GetBytes();
byte[] falseResult = falseValue.GetBytes();
Assert.AreEqual(1, trueResult.Length);
Assert.AreEqual(1, trueResult.Length);
CollectionAssert.AreEqual(trueBytes, trueResult);
CollectionAssert.AreEqual(falseBytes, falseResult);

View File

@ -15,7 +15,7 @@ namespace X10D.Tests.Core
const int repeatCount = 10;
const string repeated = "aaaaaaaaaa";
var result = character.Repeat(repeatCount);
string result = character.Repeat(repeatCount);
Assert.AreEqual(repeated, result);
Assert.ThrowsException<ArgumentOutOfRangeException>(() => character.Repeat(-1));

View File

@ -35,8 +35,8 @@ namespace X10D.Tests.Core
{
for (var index = 0; index < _primeNumbers.Count; index++)
{
var value = _primeNumbers[index];
var result = value.IsPrime();
int value = _primeNumbers[index];
bool result = value.IsPrime();
Assert.IsTrue(result, value.ToString("N0", CultureInfo.InvariantCulture));
}
}
@ -49,7 +49,7 @@ namespace X10D.Tests.Core
{
for (var value = short.MinValue; value < 0; value++)
{
var result = value.IsPrime();
bool result = value.IsPrime();
Assert.IsFalse(result, value.ToString("N0", CultureInfo.InvariantCulture));
}
}
@ -62,7 +62,7 @@ namespace X10D.Tests.Core
{
for (var value = 0; value < 2; value++)
{
var result = value.IsPrime();
bool result = value.IsPrime();
Assert.IsFalse(result, value.ToString("N0", CultureInfo.InvariantCulture));
}
}
@ -75,8 +75,8 @@ namespace X10D.Tests.Core
{
for (var value = 0; value < 7920; value++)
{
var expected = _primeNumbers.Contains(value);
var actual = value.IsPrime();
bool expected = _primeNumbers.Contains(value);
bool actual = value.IsPrime();
Assert.AreEqual(expected, actual, value.ToString("N0", CultureInfo.InvariantCulture));
}
@ -90,8 +90,8 @@ namespace X10D.Tests.Core
{
for (byte value = 0; value < byte.MaxValue; value++)
{
var expected = _primeNumbers.Contains(value);
var actual = value.IsPrime();
bool expected = _primeNumbers.Contains(value);
bool actual = value.IsPrime();
Assert.AreEqual(expected, actual, value.ToString("N0", CultureInfo.InvariantCulture));
}
@ -107,7 +107,7 @@ namespace X10D.Tests.Core
while (reader.ReadLine() is { } line)
{
if (int.TryParse(line, out var prime))
if (int.TryParse(line, out int prime))
{
primes.Add(prime);
}