31 lines
870 B
C#
31 lines
870 B
C#
namespace Tests.Stream;
|
|
|
|
public class StreamTest
|
|
{
|
|
[Theory]
|
|
[InlineData("thisfileexist.txt", true)]
|
|
[InlineData("thisfiledontexist.txt", false)]
|
|
|
|
public void ExistFileTest(string filePath, bool expected)
|
|
{
|
|
Assert.Equal(expected, global::Stream.Stream.ExistFile(filePath));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("MyReplaceTestFile.txt", 'e', 'f')]
|
|
|
|
public void MyReplaceTest(string filePath, char toReplace, char replace)
|
|
{
|
|
global::Stream.Stream.MyReplace(filePath, toReplace, replace);
|
|
Assert.Equal("Cfstvraimfntmagnifiquf\n", File.ReadAllText(filePath));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("DeleteLineTestFile.txt", 2)]
|
|
|
|
public void DeleteLineTest(string filePath, int n)
|
|
{
|
|
global::Stream.Stream.DeleteLines(filePath, n);
|
|
Assert.Equal("1\n3\n5\n7\n9\n11\n", File.ReadAllText(filePath));
|
|
}
|
|
} |