public void ReadingBadFormattedStringOfKlientaiToAListOfKlientai() { //Arrange Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var fileName = "C:\\Users\\jgrin\\Desktop\\NAUJAS.TXT"; File.WriteAllText(fileName, "\"147223840\"\"A. Narbuto įmonė\"", Encoding.GetEncoding(1257)); var rkt = new ReadKlientaiText(); var expected = new List <Klientai> { new Klientai() { Kodas = "147223840", Pavadinimas = "A. Narbuto įmonė" } }; //Act var actual = rkt.ReadKlientaiFromText(fileName); #region Testas su mockInputFile //Arrange /*var mockInputFile = new MockFileData("\"147223840\"\"A. Narbuto �mon�\"", Encoding.GetEncoding(1257)); * string fileName = "C:\\Users\\jgrin\\Desktop\\NAUJAS.TXT"; * var mockFileSystem = new MockFileSystem(); * mockFileSystem.AddFile(fileName, mockInputFile); * var sut = new ReadKlientaiText(mockFileSystem); * //Act * var actual = sut.ReadKlientaiFromText(fileName);*/ #endregion }
public void ReadingKlientaiStringWithoutValidFileNameExtension() { //Arrange string fileName = "aaaa"; var sut = new ReadKlientaiText(); //Act var temp = sut.ReadKlientaiFromText(fileName); }
public void ReadingKlientaiStringWithoutFileName() { //Arrange string fileName = ""; var sut = new ReadKlientaiText(); //Act var temp = sut.ReadKlientaiFromText(fileName); }
public void ReadingEmptyKlientaiStringToAListOfKlientai() { //Arrange Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var fileName = "C:\\Users\\jgrin\\Desktop\\NAUJAS.TXT"; File.WriteAllText(fileName, "", Encoding.GetEncoding(1257)); var rkt = new ReadKlientaiText(); //Act var actual = rkt.ReadKlientaiFromText(fileName); //Assert Assert.IsTrue(actual.Count == 0); }