public void ReadingBadFormattedStringOfSandeliaiToAListOfSandeliai() { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var fileName = "C:\\Users\\jgrin\\Desktop\\NAUJAS.TXT"; File.WriteAllText(fileName, "\"S1\"\"Bendrasis\"", Encoding.GetEncoding(1257)); var rst = new ReadSandeliaiText(); var expected = new List <Sandeliai> { new Sandeliai() { Kodas = "S1", Pavadinimas = "Bendrasis" } }; //Act var actual = rst.ReadSandeliaiFromText(fileName); #region Testas su mockInputFile //Arrange /*var mockInputFile = new MockFileData("\"S1\"\"Bendrasis\"", Encoding.GetEncoding(1257)); * string fileName = "C:\\Users\\jgrin\\Desktop\\NAUJAS.TXT"; * var mockFileSystem = new MockFileSystem(); * mockFileSystem.AddFile(fileName, mockInputFile); * var sut = new ReadSandeliaiText(mockFileSystem); * //Act * var actual = sut.ReadSandeliaiFromText(fileName);*/ #endregion }
public void ReadingSandeliaiStringWithoutValidFileNameExtension() { //Arrange string fileName = "aaaa"; var sut = new ReadSandeliaiText(); //Act var temp = sut.ReadSandeliaiFromText(fileName); }
public void ReadingSandeliaiStringWithoutFileName() { //Arrange string fileName = ""; var sut = new ReadSandeliaiText(); //Act var temp = sut.ReadSandeliaiFromText(fileName); }
public void ReadingEmptySandeliaiStringToAListOfSandeliai() { //Arrange Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var fileName = "C:\\Users\\jgrin\\Desktop\\NAUJAS.TXT"; File.WriteAllText(fileName, "", Encoding.GetEncoding(1257)); var rst = new ReadSandeliaiText(); //Act var actual = rst.ReadSandeliaiFromText(fileName); //Assert Assert.IsTrue(actual.Count == 0); }
public void SuccessfulReadingStringOfSandeliaiToAListOfSandeliai() { //Arrange Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var fileName = "C:\\Users\\jgrin\\Desktop\\NAUJAS.TXT"; File.WriteAllText(fileName, "\"S1\"\t\"Bendrasis\"", Encoding.GetEncoding(1257)); var rst = new ReadSandeliaiText(); var expected = new List <Sandeliai> { new Sandeliai() { Kodas = "S1", Pavadinimas = "Bendrasis" } }; //Act var actual = rst.ReadSandeliaiFromText(fileName); //Assert Assert.AreEqual(expected[0].Kodas, actual[0].Kodas); #region testas su mockInputFile //Arrange /*var mockInputFile = new MockFileData("\"S1\"\t\"Bendrasis\"", Encoding.GetEncoding(1257)); * string fileName = "C:\\Users\\jgrin\\Desktop\\NAUJAS.TXT"; * var mockFileSystem = new MockFileSystem(); * mockFileSystem.AddFile(fileName, mockInputFile); * var sut = new ReadSandeliaiText(mockFileSystem); * var expected = new List<Sandeliai> * { * new Sandeliai() * { * Kodas = "S1", * Pavadinimas = "Bendrasis" * } * }; * //Act * var actual = sut.ReadSandeliaiFromText(fileName); * //Assert * Assert.AreEqual(expected[0].Kodas, actual[0].Kodas);*/ #endregion }