public void GetFomeDirectoryTestBadPath() { List <TextDocument> expectedResult = new List <TextDocument>(); var testResult = TextDocument.GetFomeDirectory("badPath"); Assert.Equal(expectedResult, testResult); }
private void AddingToIndexRoutine() { var doNotExit = ""; do { var userChoice = ""; do { Console.WriteLine("Write 'f' to add single file, 'd' to add folder of files to index or 's' to skip addeing:"); userChoice = Console.ReadLine(); } while (userChoice != "f" && userChoice != "d" && userChoice != "s"); if (userChoice == "s") { return; } string path = GetPath(userChoice); switch (userChoice) { case "f": { var item = TextDocument.GetFomeFile(path); index.AddToIndex(item); break; } case "d": { var items = TextDocument.GetFomeDirectory(path); index.AddToIndex(items); break; } } Console.WriteLine("Do you like to add more data?( y / anything else ):"); doNotExit = Console.ReadLine(); } while (doNotExit == "y"); }
public void GetFomeDirectoryTest() { var expectedResult = new List <TextDocument> { new TextDocument { Path = directoryPath + "/sample", DocText = "this is simple file" }, new TextDocument { Path = directoryPath + "/sample2", DocText = "this is second document" } }; var testResult = TextDocument.GetFomeDirectory(directoryPath); Assert.Equal(expectedResult, testResult); }