public void TestShouldThrowFileNotFoundExceptionIfFileNotExists() { var fileReader = new SimpleFileReader(); string inputFilePath = Path.Combine("TestData", DateTime.Now.ToShortDateString()); Assert.Throws(typeof(FileNotFoundException), () => fileReader.Read(inputFilePath)); }
public void TestShouldReadFileAndReturnAllLines() { var fileReader = new SimpleFileReader(); string inputFilePath = Path.Combine(TestContext.CurrentContext.TestDirectory, "TestData\\testinput.txt"); IEnumerable <string> inputLines = fileReader.Read(inputFilePath); Assert.AreEqual(5, inputLines.Count()); }
public void ShouldReadFromFileAndReturnString() { string path = @"testFile.txt"; var simpleFileReader = new SimpleFileReader(new StreamReader(path)); var contentFromFile = simpleFileReader.ReadFromFile(); Assert.That(contentFromFile.Count(),Is.GreaterThan(0)); }
public void YmnosGroupTest_ValidIhos() { string folderPath = Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestData"); var reader = new SimpleFileReader(folderPath); string xml = reader.Read("YmnosGroupTest.xml"); TypiconSerializer ser = new TypiconSerializer(); YmnosGroup element = ser.Deserialize <YmnosGroup>(xml); Assert.IsTrue(element.IsValid); }
public void ShouldReadFromFileAndReturnArrayOFString() { string stringToReturn = "This string was returned with" + Environment.NewLine.ToString(CultureInfo.InvariantCulture) + "this is the second line "; var simpleFileReader = new SimpleFileReader(new StringReader(stringToReturn)); var contentFromFile = simpleFileReader.ReadFromFile(); Assert.That(contentFromFile,Is.InstanceOf<List<string>>()); Assert.That(contentFromFile.Count,Is.GreaterThan(0)); Assert.That(contentFromFile[0], Is.StringContaining("This string was returned with")); }