/// <summary> /// Uses a ReverseLineReader to read only the final line of output. /// </summary> /// <param name="reader">Reader.</param> /// <param name="filename">Filename.</param> public override void ReadBody(StreamReader reader, string filename) { ReverseLineReader revReader = new ReverseLineReader(filename); string line = revReader.First(); ReadLine(line); }
public void ShouldReturnANewLine() { var contact = new Contact { Name = "Jean", Mail = "*****@*****.**" }; _inventoryCsvManager.AddSerialNumber(contact); var _reverseStream = new ReverseLineReader(_mockedConfig["INVENTORY_PATH"]).Take(2); var inventory_name = _reverseStream.First().Split(',')[2]; Assert.AreEqual(contact.Name, inventory_name); }
public void AddSerialNumber_ShouldAddTheCorrectSerialNumber() { var contact = new Contact { Name = "Jean", Mail = "*****@*****.**" }; _inventoryCsvManager.AddSerialNumber(contact); var _reverseStream = new ReverseLineReader(_mockedConfig["INVENTORY_PATH"]).Take(2); var current = _reverseStream.First().Split(',')[0]; var previous = _reverseStream.Last().Split(',')[0]; Assert.AreEqual(long.Parse(current), long.Parse(previous) + 1); }