Push project
This commit is contained in:
27
Testing/SortingTestBase.cs
Normal file
27
Testing/SortingTestBase.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using SortingModel.SortingAlgorithms.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Testing
|
||||
{
|
||||
public abstract class SortingTestBase
|
||||
{
|
||||
protected abstract ISortingAlgorithm CreateAlgorithm();
|
||||
|
||||
[TestMethod]
|
||||
[DataRow("befdac", "abcdef")]
|
||||
[DataRow("fedba", "abdef")]
|
||||
[DataRow("aabbcc", "aabbcc")]
|
||||
[DataRow("BaDc", "BDac")]
|
||||
[DataRow("", "")]
|
||||
[DataRow("z", "z")]
|
||||
public void Sort(string input, string expected)
|
||||
{
|
||||
ISortingAlgorithm algorithm = CreateAlgorithm();
|
||||
string result = algorithm.Sort(input);
|
||||
Assert.AreEqual(expected, result, $"{algorithm.GetType().Name} Failed");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user