feat: ✨ Finish ReplaceChar
All checks were successful
Tests / Unit Testing1 (push) Successful in 46s
All checks were successful
Tests / Unit Testing1 (push) Successful in 46s
This commit is contained in:
parent
3f42af8215
commit
1a5351d121
@ -71,4 +71,12 @@ public class Iterations
|
|||||||
|
|
||||||
return result.TrimEnd();
|
return result.TrimEnd();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public static string ReplaceChar(string source, char toReplace, char replace)
|
||||||
|
{
|
||||||
|
string result = string.Empty;
|
||||||
|
result = source.Replace(toReplace, replace);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -35,4 +35,14 @@ public class IterationTests
|
|||||||
string actual = Iteration.Iterations.FirstUpper(s);
|
string actual = Iteration.Iterations.FirstUpper(s);
|
||||||
Assert.Equal(expected, actual);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user