public void NonEmptyFileContentWith2MatchesShouldGive1MatchIfWholeWordIsConsidered() { //Arrange textFileForSearch.FileContent = FakeContentFile.GetContentFile(); //Act var result = textFileForSearch.GetNumberOfMatches("debe", true); //Assert Assert.AreEqual(1, result); }
public void EmptyFileContentShoudGiveZeroMatches() { //Arrange textFileForSearch.FileContent = FakeContentFile.GetEmptyContentFile(); //Act var result = textFileForSearch.GetNumberOfMatches("hola", true); //Assert Assert.AreEqual(0, result); }
public void NonEmptyFileContentWith3MatchesShouldGive3Matches() { //Arrange textFileForSearch.FileContent = FakeContentFile.GetContentFile(); //Act var result = textFileForSearch.GetNumberOfMatches("prueba", true); //Assert Assert.AreEqual(3, result); }
private void CreateFiles(string path, int numberOfFiles, bool informContent) { for (int i = 0; i < numberOfFiles; i++) { var fileName = $"TextFile{i}.txt"; var nameToCreate = $"{path}\\{fileName}"; if (File.Exists(nameToCreate)) { File.Delete(nameToCreate); } var file = File.CreateText(nameToCreate); if (informContent) { file.Write(FakeContentFile.GetContentFile()); file.Flush(); } file.Close(); } }