public void Read_GivenLessLinesThanTheFileHas_ReturnsAllContentAsString() { string expectedContent = "asdasdasd\r\nkajak\r\nCodecool\r\nlol\r\ntest\r\nkerek"; _filePartReader.Setup("test.txt", 1, 3); string fileContent = _filePartReader.Read(); Assert.AreEqual(expectedContent, fileContent); }
public void TestReadThrowsIOExceptionWhenFileNotFound() { // arrange FilePartReader filePartReader = new FilePartReader(); filePartReader.Setup("nonExistingFile", 1, 3); //assert Assert.Throws <FileNotFoundException>(() => filePartReader.Read()); }
public void TestReadGetFileContentWhenReadFromExistingFile() { // arrange FilePartReader filePartReader = new FilePartReader(); int fromLine = 1; int toLine = 3; filePartReader.Setup("d:\\test.txt", fromLine, toLine); String _expected = "first line of text" + Environment.NewLine + "second line of ala" + Environment.NewLine + "last of best radar"; // act String _actual = filePartReader.Read(); // assert Assert.That(_actual, Is.EqualTo(_expected)); }
public void ThrowArgumentExceptionAtDefaultSetup() { Assert.Throws <ArgumentException>(() => _filePartReader.Read()); }
public void ShouldReadFileFromStartTillEnd() { string expectedResult = FilePartReader.Read(); Assert.That(expectedResult, Is.EqualTo("Something Changed\r\nMama\r\nPapa\r\nChocolate Vanilla\r\nSas\r\nChocoPops\r\nAnna")); }