public void ReadFromTxt_NotExist_ReturnEmpty() { TxtDB txtDb = new TxtDB("testEmpty"); Assert.IsEmpty(txtDb.ReadLastLine()); txtDb.DumpFile(); }
public void CreateOrWriteToTxt() { TxtDB txtDb = new TxtDB("info"); string teststring = "Testing" + Guid.NewGuid().ToString("N"); txtDb.AppendAndSave(teststring); string lastline = txtDb.ReadLastLine(); Assert.AreEqual(lastline, teststring); }
public void WriteAndReadJsonData() { TxtDB txtDb = new TxtDB("jsonTest"); txtDb.OverWrite(JsonConvert.SerializeObject(TestObj.GetTestObj(), Formatting.Indented)); string jsontxt = txtDb.ReadAll(); Assert.AreEqual(JsonConvert.DeserializeObject <TestObj>(jsontxt), TestObj.GetTestObj()); txtDb.DumpFile(); }
public void ReadAllAndWriteAll() { TxtDB txtDb = new TxtDB("info"); string alltext = txtDb.ReadAll(); string testString = "Addtest" + Guid.NewGuid().ToString("N"); if (!alltext.EndsWith(Environment.NewLine)) { alltext += Environment.NewLine; } alltext += testString; txtDb.OverWrite(alltext); Assert.AreEqual(testString, txtDb.ReadLastLine()); }
public void Setup() { txtDb = new TxtDB("taskcommandtest"); }