48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
namespace Tests.Interatif;
|
|
|
|
public class IterationTests
|
|
{
|
|
[Theory]
|
|
[InlineData(123, 321)]
|
|
[InlineData(1234, 4321)]
|
|
[InlineData(4, 4)]
|
|
[InlineData(-4, -4)]
|
|
[InlineData(24, 42)]
|
|
[InlineData(-123456, -654321)]
|
|
|
|
public void ReverseintTest(int n, int expected)
|
|
{
|
|
int actual = Iteration.Iterations.Reverseint(n);
|
|
Assert.Equal(expected, actual);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("Clement est le plus beau", "moche", false)]
|
|
[InlineData("Clement est le plus beau", "beau", true)]
|
|
|
|
public void FindSubTest(string s, string sub, bool expected)
|
|
{
|
|
bool actual = Iteration.Iterations.FindSub(s, sub);
|
|
Assert.Equal(expected, actual);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("Je me crois en enfer, donc j'y suis.", "Je Me Crois En Enfer, Donc J'y Suis.")]
|
|
[InlineData("!abc !def ghi .klm", "!abc !def Ghi .klm")]
|
|
|
|
public void CapitalizeTest(string s, string expected)
|
|
{
|
|
string actual = Iteration.Iterations.FirstUpper(s);
|
|
Assert.Equal(expected, actual);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("De la programmation avant toute chose.", 'a', '*', "De l* progr*mm*tion *v*nt toute chose.")]
|
|
[InlineData("De la programmation avant toute chose.", 'a', '!', "De l! progr!mm!tion !v!nt toute chose.")]
|
|
|
|
public void ReplaceTest(string s, char old, char next, string expected)
|
|
{
|
|
string actual = Iteration.Iterations.ReplaceChar(s, old, next);
|
|
Assert.Equal(expected, actual);
|
|
}
|
|
} |