28 lines
756 B
C#
28 lines
756 B
C#
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");
|
|
}
|
|
|
|
}
|
|
}
|