public void ReadCommandsFromEmptyFileShouldReturnEmptyCommandsSet() { string filePath = FilePathStart + "EmptyCommandsFile.txt"; string fileContent = TestDataCommandsFiles[3]; PhoneBookManipulator manipulator = new PhoneBookManipulator(); List <string[]> commandsFound = manipulator.ReadCommandsFromFile(writeTestDataFile(fileContent, filePath)); Assert.IsTrue(commandsFound.Count == 0); }
public void ReadWrongFormattedCommandsFromFileShouldReadOnlyCorrectOnesInCommandsSet() { string filePath = FilePathStart + "WrongFormattedCommandsFile.txt"; string fileContent = TestDataCommandsFiles[1]; //3 from 7 commands in TestData have wrong formatting PhoneBookManipulator manipulator = new PhoneBookManipulator(); try { List <string[]> commandsFound = manipulator.ReadCommandsFromFile(writeTestDataFile(fileContent, filePath)); } catch (FormatException e) { //We expect only 4 commands from all 7 in file to be in commandsFound Assert.IsTrue(e.Message.Contains("Invalid") && e.Message.Contains("passed - check syntax!") && e.Message.Contains("find")//This is second find command in current DataSet ); } }