Skip to content

Commit a3cbd0d

Browse files
1fisedisiriak
authored andcommitted
Add static modifier where possible (#108)
1 parent b0ceffe commit a3cbd0d

27 files changed

+79
-80
lines changed

Algorithms.Tests/Compressors/HuffmanCompressorTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
namespace Algorithms.Tests.Compressors
77
{
8-
public class HuffmanCompressorTests
8+
public static class HuffmanCompressorTests
99
{
1010
[Test]
1111
[TestCase("This is a string", "101010110111011101110111100011111010010010010011000")]
1212
[TestCase("Hello", "1101110010")]
1313
[TestCase("dddddddddd", "1111111111")]
1414
[TestCase("a", "1")]
1515
[TestCase("", "")]
16-
public void CompressingPhrase(string uncompressedText, string expectedCompressedText)
16+
public static void CompressingPhrase(string uncompressedText, string expectedCompressedText)
1717
{
1818
//Arrange
1919
var sorter = new BubbleSorter<HuffmanCompressor.ListNode>();
@@ -30,7 +30,7 @@ public void CompressingPhrase(string uncompressedText, string expectedCompressed
3030
}
3131

3232
[Test]
33-
public void DecompressedTextTheSameAsOriginal([Random(0, 1000, 100, Distinct = true)]int length)
33+
public static void DecompressedTextTheSameAsOriginal([Random(0, 1000, 100, Distinct = true)]int length)
3434
{
3535
//Arrange
3636
var sorter = new BubbleSorter<HuffmanCompressor.ListNode>();

Algorithms.Tests/Compressors/ShannonFanoCompressorTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
namespace Algorithms.Tests.Compressors
77
{
8-
public class ShannonFanoCompressorTests
8+
public static class ShannonFanoCompressorTests
99
{
1010
[Test]
1111
[TestCase("dddddddddd", "1111111111")]
1212
[TestCase("a", "1")]
1313
[TestCase("", "")]
14-
public void CompressingPhrase(string uncompressedText, string expectedCompressedText)
14+
public static void CompressingPhrase(string uncompressedText, string expectedCompressedText)
1515
{
1616
//Arrange
1717
var solver = new NaiveKnapsackSolver<(char, double)>();
@@ -28,7 +28,7 @@ public void CompressingPhrase(string uncompressedText, string expectedCompressed
2828
}
2929

3030
[Test]
31-
public void DecompressedTextTheSameAsOriginal([Random(0, 1000, 100)]int length)
31+
public static void DecompressedTextTheSameAsOriginal([Random(0, 1000, 100)]int length)
3232
{
3333
//Arrange
3434
var solver = new NaiveKnapsackSolver<(char, double)>();

Algorithms.Tests/Compressors/TranslatorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace Algorithms.Tests.Compressors
66
{
7-
public class TranslatorTests
7+
public static class TranslatorTests
88
{
99
[Test]
10-
public void TranslateCorrectly()
10+
public static void TranslateCorrectly()
1111
{
1212
// Arrange
1313
var translator = new Translator();

Algorithms.Tests/Encoders/CaesarEncoderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace Algorithms.Tests.Encoders
66
{
7-
public class CaesarEncoderTests
7+
public static class CaesarEncoderTests
88
{
99
[Test]
10-
public void DecodedStringIsTheSame([Random(100)]int key)
10+
public static void DecodedStringIsTheSame([Random(100)]int key)
1111
{
1212
// Arrange
1313
var encoder = new CaesarEncoder();

Algorithms.Tests/Encoders/HillEnconderTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44

55
namespace Algorithms.Tests.Encoders
66
{
7-
public class HillEnconderTests
7+
public static class HillEnconderTests
88
{
9-
// TODO: Add more random tests
109
[Test]
1110
[Repeat(100)]
12-
public void DecodedStringIsTheSame()
11+
public static void DecodedStringIsTheSame()
1312
{
1413
// Arrange
1514
var encoder = new HillEncoder();

Algorithms.Tests/Encoders/VigenereEncoderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace Algorithms.Tests.Encoders
66
{
7-
public class VigenereEncoderTests
7+
public static class VigenereEncoderTests
88
{
99
[Test]
1010
[Repeat(100)]
11-
public void DecodedStringIsTheSame()
11+
public static void DecodedStringIsTheSame()
1212
{
1313
// Arrange
1414
var random = new Randomizer();

Algorithms.Tests/Helpers/RandomHelper.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ internal static class RandomHelper
66
{
77
public static (int[] correctArray, int[] testArray) GetArrays(int n)
88
{
9-
var testArray = new int[n];
9+
var testArr = new int[n];
1010
var correctArray = new int[n];
11+
1112
for (var i = 0; i < n; i++)
1213
{
1314
var t = TestContext.CurrentContext.Random.Next(0, 1000);
14-
testArray[i] = t;
15+
testArr[i] = t;
1516
correctArray[i] = t;
1617
}
17-
return (correctArray, testArray);
18+
19+
return (correctArray, testArr);
1820
}
1921
}
2022
}

Algorithms.Tests/Knapsack/NaiveKnapsackSolverTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace Algorithms.Tests.Knapsack
66
{
7-
public class NaiveKnapsackSolverTests
7+
public static class NaiveKnapsackSolverTests
88
{
99
[Test]
10-
public void TakesHalf([Random(0, 1000, 100,Distinct = true)]int length)
10+
public static void TakesHalf([Random(0, 1000, 100, Distinct = true)]int length)
1111
{
1212
//Arrange
1313
var solver = new NaiveKnapsackSolver<int>();

Algorithms.Tests/Numeric/GreatestCommonDivisor/BinaryGreatestCommonDivisorFinderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Algorithms.Tests.Numeric.GreatestCommonDivisor
55
{
6-
public class BinaryGreatestCommonDivisorFinderTests
6+
public static class BinaryGreatestCommonDivisorFinderTests
77
{
88
[Test]
99
[TestCase(2, 3, 1)]
@@ -15,7 +15,7 @@ public class BinaryGreatestCommonDivisorFinderTests
1515
[TestCase(2 * 17, 17, 17)]
1616
[TestCase(0, 0, int.MaxValue)]
1717
[TestCase(2 * 13 * 17, 4 * 9 * 13, 2 * 13)]
18-
public void GreatestCommonDivisorCorrect(int a, int b, int expectedGcd)
18+
public static void GreatestCommonDivisorCorrect(int a, int b, int expectedGcd)
1919
{
2020
// Arrange
2121
var gcdFinder = new BinaryGreatestCommonDivisorFinder();

Algorithms.Tests/Numeric/GreatestCommonDivisor/EuclideanGreatestCommonDivisorFinderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Algorithms.Tests.Numeric.GreatestCommonDivisor
55
{
6-
public class EuclideanGreatestCommonDivisorFinderTests
6+
public static class EuclideanGreatestCommonDivisorFinderTests
77
{
88
[Test]
99
[TestCase(2, 3, 1)]
@@ -15,7 +15,7 @@ public class EuclideanGreatestCommonDivisorFinderTests
1515
[TestCase(2 * 17, 17, 17)]
1616
[TestCase(0, 0, int.MaxValue)]
1717
[TestCase(2 * 13 * 17, 4 * 9 * 13, 2 * 13)]
18-
public void GreatestCommonDivisorCorrect(int a, int b, int expectedGcd)
18+
public static void GreatestCommonDivisorCorrect(int a, int b, int expectedGcd)
1919
{
2020
// Arrange
2121
var gcdFinder = new EuclideanGreatestCommonDivisorFinder();

0 commit comments

Comments
 (0)